void CNB_Select_Marine_Panel::InitMarineList() { // create entry panels for our horizontal list if ( !MarineProfileList() ) { Warning( "Failed to get marine profile list\n" ); MarkForDeletion(); return; } int nProfiles = MarineProfileList()->m_NumProfiles; for ( int i = 0; i < nProfiles; i++ ) { CNB_Select_Marine_Entry *pEntry = new CNB_Select_Marine_Entry( this, "Entry" ); //Assert( NELEMS( s_nProfileOrder ) == nProfiles ); // if this assert fails, then s_nProfileOrder needs to be updated to match the new profile list int nProfileIndex = i;//s_nProfileOrder[ i ]; vgui::PHandle handle; handle = pEntry; pEntry->SetProfileIndex( nProfileIndex ); pEntry->m_nPreferredLobbySlot = m_nPreferredLobbySlot; pEntry->InvalidateLayout( true, true ); m_Entries.AddToTail( handle ); } m_nHighlightedEntry = m_nInitialProfileIndex; if ( m_nHighlightedEntry == -1 ) m_nHighlightedEntry = 0; InvalidateLayout( true, true ); }
void CNB_Spend_Skill_Points::OnCommand( const char *command ) { if ( !Q_stricmp( command, "BackButton" ) ) { CNB_Main_Panel::RemoveFromSpendQueue( m_nProfileIndex ); MarkForDeletion(); Briefing()->SetChangingWeaponSlot( 0 ); CNB_Main_Panel *pMainPanel = dynamic_cast<CNB_Main_Panel*>( GetParent() ); if ( pMainPanel ) { pMainPanel->OnFinishedSpendingSkillPoints(); } return; } else if ( !Q_stricmp( command, "SkillUndo" ) ) { char buffer[16]; Q_snprintf( buffer, sizeof(buffer), "cl_undoskill %d", m_nProfileIndex ); engine->ClientCmd(buffer); CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "ASWInterface.Button4" ); return; } BaseClass::OnCommand( command ); }
void CainMailPanel::OnThink() { //PerformLayout(); for (int i=0;i<ASW_CAIN_MAIL_LINES;i++) { //m_MailLines[i]->InvalidateLayout(true); } // check for adding a new credits message if (gpGlobals->curtime > m_fFadeOutTime) { if (m_fFadeOutTime != 0) { // start fading out for (int i=0;i<ASW_CAIN_MAIL_LINES;i++) { vgui::GetAnimationController()->RunAnimationCommand(m_MailLines[i], "Alpha", 0, 1.0f + i * 0.1f, 2.0f, vgui::AnimationController::INTERPOLATOR_LINEAR); } m_fFadeOutTime = 0; } else { // if we've faded out, close this panel if (m_MailLines[ASW_CAIN_MAIL_LINES-1]->GetAlpha() == 0) { SetVisible(false); MarkForDeletion(); } } } }
bool CASW_VGUI_Skip_Intro::MouseClick(int x, int y, bool bRightClick, bool bDown) { engine->ClientCmd("cl_skip_intro"); MarkForDeletion(); SetVisible(false); return true; // swallow click }
void Holdout_Wave_Announce_Panel::OnThink() { BaseClass::OnThink(); #if 0 if ( m_flWaveNumberSoundTime != 0.0f && gpGlobals->curtime >= m_flWaveNumberSoundTime ) { m_flWaveNumberSoundTime = 0.0f; CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "Holdout.GetReadySlam" ); } if ( m_flGetReadySlideSoundTime != 0.0f && gpGlobals->curtime >= m_flGetReadySlideSoundTime ) { m_flGetReadySlideSoundTime = 0.0f; CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "Holdout.GetReadySlide" ); } if ( m_flGetReadySoundTime != 0.0f && gpGlobals->curtime >= m_flWaveNumberSoundTime ) { m_flGetReadySoundTime = 0.0f; CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1 /*SOUND_FROM_LOCAL_PLAYER*/, "Holdout.GetReadySlam" ); } #endif if ( gpGlobals->curtime > m_flClosePanelTime ) { MarkForDeletion(); } }
void CASW_Difficulty_Chooser::OnCommand(const char* command) { if (!stricmp(command, "Cancel")) { SetVisible(false); MarkForDeletion(); } }
void CNB_Weapon_Unlocked::OnCommand( const char *command ) { if ( !Q_stricmp( command, "BackButton" ) ) { MarkForDeletion(); return; } BaseClass::OnCommand( command ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseActionEditDialog::OnCancel() { if ( m_bNewAction ) { delete m_pAction; } // Nothing, just delete MarkForDeletion(); BaseClass::OnClose(); }
void CASW_Difficulty_Chooser::DifficultyEntryClicked(int iDifficulty) { if (iDifficulty < 1 || iDifficulty > ASW_NUM_DIFFICULTIES) return; char szCommand[1024]; Q_snprintf(szCommand, sizeof(szCommand), "disconnect\nwait\nwait\nwait\nasw_skill %d\n%s", iDifficulty, m_szLaunchCommand); SetVisible(false); MarkForDeletion(); engine->ClientCmd(szCommand); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void VideoPlayerPanel::OnClose( void ) { StopVideo(); // enginesound->NotifyEndMoviePlayback(); vgui::surface()->RestrictPaintToSinglePanel( NULL ); SetVisible( false ); MarkForDeletion(); }
void CNB_Select_Level_Panel::LevelSelected( const char *pLevelName ) { if ( !pLevelName || pLevelName[0] == 0 ) return; // pass selected mission name up to vgamesettings char buffer[ 256 ]; Q_snprintf( buffer, sizeof( buffer ), "cmd_level_selected_%s", pLevelName ); GetParent()->OnCommand( buffer ); MarkForDeletion(); }
void FontTestPanel::OnMouseReleased(vgui::MouseCode code) { if (code == MOUSE_LEFT) { m_iPage = 1 - m_iPage; } else { MarkForDeletion(); SetVisible(false); } }
void CNB_Select_Mission_Panel::MissionSelected( ASW_Mission_Chooser_Mission *pMission ) { if ( !pMission || !pMission->m_szMissionName || pMission->m_szMissionName[0] == 0 ) return; // pass selected mission name up to vgamesettings char buffer[ 256 ]; Q_snprintf( buffer, sizeof( buffer ), "cmd_mission_selected_%s", pMission->m_szMissionName ); GetParent()->OnCommand( buffer ); MarkForDeletion(); }
// // Draw control // void PrereqTree::DrawSelf(PaintInfo &pi) { if (constructor.Alive()) { // Draw all the items S32 height = pi.client.Height(); S32 yoffset = height / 2; S32 x = point.x; S32 y = point.y; // Move the client/window areas up to the top left Point<S32> offset(pi.client.p1.x, pi.client.p0.y); pi.client -= offset; pi.window -= offset; x -= 30; Point<S32> o(x, y); pi.client += o; pi.window += o; controlState |= STATE_HILITE; DrawCtrlBackground(pi, GetTexture()); DrawCtrlFrame(pi); DrawCtrlText(pi, type->GetDesc()); controlState &= ~STATE_HILITE; pi.client -= o; pi.window -= o; IFace::RenderRectangle(ClipRect(point.x - 30, point.y + yoffset, point.x, point.y + yoffset + 1), Color(1.0f, 1.0f, 1.0f, pi.alphaScale), NULL, pi.alphaScale); x -= pi.client.Width(); S32 savey = y; S32 bottom = savey; Draw(TRUE, pi, x - 30, y, bottom, type); // Draw lines if (y > savey) { IFace::RenderRectangle(ClipRect(x - 25, point.y + yoffset, x, point.y + yoffset + 1), Color(1.0f, 1.0f, 1.0f, pi.alphaScale), NULL, pi.alphaScale); IFace::RenderRectangle(ClipRect(x - 25, savey + yoffset, x - 24, bottom + yoffset + 1), Color(1.0f, 1.0f, 1.0f, pi.alphaScale), NULL, pi.alphaScale); } } else { MarkForDeletion(); } }
// // Done // // Called when the object has been executed and can be deleted // Bool OffMapObj::Done() { // Notify the facility if (facility.Alive()) { facility->PostEvent(Task::Event(0xC44A7A13, Id())); // "Order::UnitConstructor::ClearOffMap" } // Delete this object MarkForDeletion(); // Mark as completed incase of duplicate orders return (executed = TRUE); }
void CNB_Select_Level_Panel::OnCommand( const char *command ) { if ( !Q_stricmp( command, "BackButton" ) ) { MarkForDeletion(); return; } else if ( !Q_stricmp( command, "AcceptButton" ) ) { GetParent()->OnCommand( command ); return; } BaseClass::OnCommand( command ); }
void CommandMenu::ClearMenu() { SetVisible( false ); m_pMenuStack.Clear(); m_MenuItems.RemoveAll(); // DeleteAllItems(); MarkForDeletion(); if ( m_MenuKeys ) { m_MenuKeys->deleteThis(); m_MenuKeys = NULL; } }
// // ExplosionObj::ProcessCycle // // Per-cycle processing // void ExplosionObj::ProcessCycle() { PERF_S(("ExplosionObj")) // Apply damage ExplosionType()->Apply(Origin(), sourceUnit.GetPointer(), sourceTeam); // Has the persistence time expired ? if (GetBirthTime() + ExplosionType()->persist < GameTime::SimTotalTime()) { MarkForDeletion(); } PERF_E(("ExplosionObj")) }
//----------------------------------------------------------------------------- // Purpose: Delete panel when highlight has faded out //----------------------------------------------------------------------------- void CASWSelectOverlayPulse::OnThink() { if ( m_pOverlayLabel && gpGlobals->curtime > m_fStartTime ) { if ( m_bStarted ) { m_bStarted = false; vgui::GetAnimationController()->RunAnimationCommand( m_pOverlayLabel, "alpha", 0, 0.21, 1.0f, vgui::AnimationController::INTERPOLATOR_DEACCEL ); } else if ( m_pOverlayLabel->GetAlpha() <= 0 ) { MarkForDeletion(); SetVisible( false ); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBaseActionEditDialog::OnClose() { if ( m_bNewAction ) { demoaction->AddAction( m_pAction ); } g_BaseActionEditSaveChained = false; if ( OnSaveChanges() || m_bNewAction ) { demoaction->SetDirty( true ); m_pEditor->OnRefresh(); } Assert( g_BaseActionEditSaveChained ); MarkForDeletion(); BaseClass::OnClose(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void VideoPanel::OnClose( void ) { m_bRepeat = false; if ( m_bPlaying ) { Stop(); } bik->DestroyMaterial( m_BIKHandle ); m_BIKHandle = BIKHANDLE_INVALID; m_bPlaying = false; BaseClass::OnClose(); SetVisible( false ); MarkForDeletion(); }
EXPORT_C void CAsyncRequest::CompleteAndMarkForDeletion(TInt aError) /** Completes the client-side request associated with this asynchronous request and marks this object for deletion. If the error was because the client passed a bad descriptor then panick the client instead of completing the request for consistency with synchronous requests. @param aError Error code with which the client request will be completed. */ { if (aError == KErrBadDescriptor) PanicClient(iMessagePtr2, ScsImpl::EScsClBadDesc); else iMessagePtr2.Complete(aError); MarkForDeletion(); }
//----------------------------------------------------------------------------- // CASWSelectOverlayPulse // // creates a highlight pulse over the panel of an offhand item that has just been used // //----------------------------------------------------------------------------- CASWSelectOverlayPulse::CASWSelectOverlayPulse( vgui::Panel* pParent ) { SetPaintBackgroundEnabled( false ); m_pParent = NULL; m_bStarted = false; m_fScale = 1.1; if ( pParent ) { m_pParent = pParent; SetParent( pParent->GetParent() ); Initialize(); } else { MarkForDeletion(); SetVisible( false ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void VideoPanel::OnClose( void ) { enginesound->NotifyEndMoviePlayback(); BaseClass::OnClose(); if ( vgui::input()->GetAppModalSurface() == GetVPanel() ) { vgui::input()->ReleaseAppModalSurface(); } vgui::surface()->RestrictPaintToSinglePanel( NULL ); // Fire an exit command if we're asked to do so if ( m_szExitCommand[0] ) { engine->ClientCmd( m_szExitCommand ); } SetVisible( false ); MarkForDeletion(); }
void CASW_VGUI_Info_Message::OnThink() { UpdateMessage(); int x,y,w,t; GetBounds(x,y,w,t); InvalidateLayout(true); if (m_pOkayButton->IsCursorOver()) { m_pOkayButton->SetBgColor(Color(255,255,255,200)); m_pOkayButton->SetFgColor(Color(0,0,0,255)); } else { m_pOkayButton->SetBgColor(Color(19,20,40,200)); m_pOkayButton->SetFgColor(Color(255,255,255,255)); } if (m_pLogButton) { if (m_pLogButton->IsCursorOver()) { m_pLogButton->SetBgColor(Color(255,255,255,200)); m_pLogButton->SetFgColor(Color(0,0,0,255)); } else { m_pLogButton->SetBgColor(Color(19,20,40,200)); m_pLogButton->SetFgColor(Color(255,255,255,255)); } } if (m_bClosingMessage && GetAlpha() <= 0) { SetVisible(false); MarkForDeletion(); } }
void FadeInPanel::OnThink() { // fade out if we're ingame for more than a second if (ASWGameRules() && ASWGameRules()->GetGameState() == ASW_GS_INGAME) { //Msg("FadeInPanel ingame, m_fIngameTime = %f\n", m_fIngameTime); m_fIngameTime += gpGlobals->frametime; if (m_fIngameTime >= 2.0f || m_bFastRemove) { m_bSlowRemove = true; } } if (GetAlpha() >= 255 && m_bSlowRemove) { SetAlpha(254); vgui::GetAnimationController()->RunAnimationCommand(this, "alpha", 0, 0.0f, 1.5f, vgui::AnimationController::INTERPOLATOR_LINEAR); } if (GetAlpha() <= 0) { MarkForDeletion(); } }
// // ICWindow::HandleEvent // // Handle input events // U32 ICWindow::HandleEvent(Event &e) { if (e.type == Input::EventID()) { // Input events switch (e.subType) { case Input::MOUSEBUTTONDOWN: { if (e.input.code == Input::LeftButtonCode()) { if (InWindow(Point<S32>(e.input.mouseX, e.input.mouseY))) { // Raise window SendNotify(this, ICWindowMsg::Raise, FALSE); // Handled return (TRUE); } } break; } case Input::KEYDOWN: case Input::KEYREPEAT: { switch (e.input.code) { case DIK_TAB: { // If nothing has the focus then activate the first tab stop control if (IFace::GetFocus() == NULL) { SetTabStop(NULL, TRUE); // Handled return (TRUE); } // Not handled break; } case DIK_ESCAPE: { // If modal then issue the Window::Close notification if ((controlStyle & STYLE_MODAL) && !(windowStyle & STYLE_NOSYSBUTTONS)) { // Close window SendNotify(this, ICWindowMsg::Close, FALSE); // Handled return (TRUE); } // Not handled break; } } // Not handled break; } } } else if (e.type == IFace::EventID()) { switch (e.subType) { // Notification events case IFace::NOTIFY: { switch (e.iface.p1) { case ICWindowMsg::Raise: { // Raise the window SetZPos(0); // Handled return (TRUE); } case ICWindowMsg::Close: { // Close window Deactivate(); // Handled return (TRUE); } case ICWindowMsg::Maximize: case ICWindowMsg::Minimize: { // Not implemented break; } case ICWindowMsg::Destroy: { // Mark for deletion MarkForDeletion(); // Handled return (TRUE); } } // Not handled break; } } } // This event can't be handled by this control, so pass it to the parent class return (IControl::HandleEvent(e)); }
AURSTATE CParticleSystem :: UpdateSystem( float frametime ) { if( m_pEntity != NULL ) { // don't update if the system is outside the player's PVS. if( m_pEntity->curstate.messagenum != r_currentMessageNum ) { // but always update rocket particles if( !FBitSet( m_pEntity->curstate.effects, EF_NUKE_ROCKET )) return AURORA_INVISIBLE; } // time-based particle system if( m_fLifeTime != 0.0f ) { enable = (m_fLifeTime >= RI.refdef.time) ? true : false; } else { enable = (m_pEntity->curstate.renderfx == kRenderFxAurora) ? true : false; } // check for contents to remove if( m_iKillCondition == POINT_CONTENTS( m_pEntity->origin )) { m_pEntity = NULL; enable = false; } } else { enable = false; } if( m_pEntity != NULL ) { Vector angles = m_pEntity->angles; // get the system entity matrix if( m_iEntAttachment && m_pEntity->model->type == mod_studio ) entityMatrix.FromVector( R_StudioAttachmentDir( m_pEntity, m_iEntAttachment - 1 )); else entityMatrix = matrix3x3( angles ); } if( m_pMainParticle == NULL ) { if( enable ) { CParticleType *pType = m_pMainType; if( pType ) { m_pMainParticle = pType->CreateParticle( this ); if( m_pMainParticle ) { // first origin initialize if( m_iEntAttachment && m_pEntity->model->type == mod_studio ) m_pMainParticle->origin = R_StudioAttachmentPos( m_pEntity, m_iEntAttachment - 1 ); else m_pMainParticle->origin = m_pEntity->origin; m_pMainParticle->m_pEntity = m_pEntity; m_pMainParticle->age_death = -1.0f; // never die } } } } else if( !enable ) { MarkForDeletion(); } // last particle is died, allow to remove partsystem if( !m_pEntity && !m_pActiveParticle ) return AURORA_REMOVE; CParticle *pParticle = m_pActiveParticle; CParticle *pLast = NULL; while( pParticle ) { if( UpdateParticle( pParticle, frametime )) { pLast = pParticle; pParticle = pParticle->nextpart; } else { // deactivate it if( pLast ) { pLast->nextpart = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = pLast->nextpart; } else { // deactivate the first CParticle in the list m_pActiveParticle = pParticle->nextpart; pParticle->nextpart = m_pFreeParticle; m_pFreeParticle = pParticle; pParticle = m_pActiveParticle; } } } return AURORA_DRAW; }
void CNB_Select_Marine_Panel::OnCommand( const char *command ) { if ( !Q_stricmp( command, "BackButton" ) ) { Briefing()->SetChangingWeaponSlot( 0 ); MarkForDeletion(); CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1, "ASWComputer.MenuBack" ); return; } else if ( !Q_stricmp( command, "AcceptButton" ) ) { CNB_Select_Marine_Entry *pHighlighted = dynamic_cast<CNB_Select_Marine_Entry*>( GetHighlightedEntry() ); if ( pHighlighted ) { int nProfileIndex = pHighlighted->GetProfileIndex(); if ( !Briefing()->IsProfileSelectedBySomeoneElse( nProfileIndex ) ) { Briefing()->SelectMarine( 0, nProfileIndex, m_nPreferredLobbySlot ); // is this the first marine we've selected? if ( Briefing()->IsOfflineGame() && ASWGameResource() && ASWGameResource()->GetNumMarines( NULL ) <= 0 ) { //Briefing()->AutoSelectFullSquadForSingleplayer( nProfileIndex ); } bool bHasPointsToSpend = Briefing()->IsCampaignGame() && !Briefing()->UsingFixedSkillPoints() && ( Briefing()->GetProfileSkillPoints( nProfileIndex, ASW_SKILL_SLOT_SPARE ) > 0 ); if ( bHasPointsToSpend ) { CNB_Main_Panel *pPanel = dynamic_cast<CNB_Main_Panel*>( GetParent() ); if ( pPanel ) { pPanel->SpendSkillPointsOnMarine( nProfileIndex ); } } else { MarkForDeletion(); Briefing()->SetChangingWeaponSlot( 0 ); } CASW_Marine_Profile* pProfile = Briefing()->GetMarineProfileByProfileIndex( nProfileIndex ); if ( pProfile ) { engine->ClientCmd_Unrestricted(VarArgs("exec configloader/chars/%s\n", pProfile->m_PortraitName)); switch (pProfile->GetMarineClass()) { case MARINE_CLASS_NCO: engine->ClientCmd_Unrestricted("exec configloader/chars/Officer\n"); break; case MARINE_CLASS_SPECIAL_WEAPONS: engine->ClientCmd_Unrestricted("exec configloader/chars/SpecialWeapons\n"); break; case MARINE_CLASS_MEDIC: engine->ClientCmd_Unrestricted("exec configloader/chars/Medic\n"); break; case MARINE_CLASS_TECH: engine->ClientCmd_Unrestricted("exec configloader/chars/Tech\n"); break; default: Assert(0); } } } else { CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, -1, "ASWComputer.TimeOut" ); } } return; } BaseClass::OnCommand( command ); }