//----------------------------------------------------------------------------- // Purpose: // Input : *modelname - //----------------------------------------------------------------------------- void CBaseViewModel::SetWeaponModel( const char *modelname, CBaseCombatWeapon *weapon ) { m_hWeapon = weapon; #if defined( CLIENT_DLL ) SetModel( modelname ); #else string_t str; if ( modelname != NULL ) { str = MAKE_STRING( modelname ); } else { str = NULL_STRING; } if ( str != m_sVMName ) { // Msg( "SetWeaponModel %s at %f\n", modelname, gpGlobals->curtime ); m_sVMName = str; SetModel( STRING( m_sVMName ) ); // Create any vgui control panels associated with the weapon SpawnControlPanels(); bool showControlPanels = weapon && weapon->ShouldShowControlPanels(); SetControlPanelsActive( showControlPanels ); } #endif }
//----------------------------------------------------------------------------- // Here's where we deal with weapons, ladders, etc. //----------------------------------------------------------------------------- void CVehicleTeleportStation::OnItemPostFrame( CBaseTFPlayer *pDriver ) { // I can't do anything if I'm not active if ( !ShouldBeActive() ) return; if ( GetPassengerRole( pDriver ) != VEHICLE_DRIVER ) return; if ( !IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) ) { if ( ValidDeployPosition() ) { Deploy(); } } else if ( IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) ) { UnDeploy(); SetControlPanelsActive( false ); SetBodygroup( 1, true ); RemoveCornerSprites(); SetContextThink( NULL, 0, TELEPORT_STATION_THINK_CONTEXT ); } }
//----------------------------------------------------------------------------- // Purpose: Pass our visibility on to our child screens //----------------------------------------------------------------------------- void CBaseViewModel::RemoveEffects( int nEffects ) { if ( nEffects & EF_NODRAW ) { SetControlPanelsActive( true ); } BaseClass::RemoveEffects( nEffects ); }
//----------------------------------------------------------------------------- // Purpose: Pass our visibility on to our child screens //----------------------------------------------------------------------------- void CBaseViewModel::AddEffects( int nEffects ) { if ( nEffects & EF_NODRAW ) { SetControlPanelsActive( false ); } BaseClass::AddEffects( nEffects ); }
//----------------------------------------------------------------------------- // Purpose: // Input : sequence - //----------------------------------------------------------------------------- void CBaseViewModel::SendViewModelMatchingSequence( int sequence ) { // since all we do is send a sequence number down to the client, // set this here so other weapons code knows which sequence is playing. SetSequence( sequence ); m_nAnimationParity = ( m_nAnimationParity + 1 ) & ( (1<<VIEWMODEL_ANIMATION_PARITY_BITS) - 1 ); #if defined( CLIENT_DLL ) m_nOldAnimationParity = m_nAnimationParity; // Force frame interpolation to start at exactly frame zero m_flAnimTime = gpGlobals->curtime; #else CBaseCombatWeapon *weapon = m_hWeapon.Get(); bool showControlPanels = weapon && weapon->ShouldShowControlPanels(); SetControlPanelsActive( showControlPanels ); #endif // Restart animation at frame 0 SetCycle( 0 ); ResetSequenceInfo(); }
//----------------------------------------------------------------------------- // Purpose: Finished our deploy //----------------------------------------------------------------------------- void CVehicleTeleportStation::OnFinishedDeploy( void ) { BaseClass::OnFinishedDeploy(); ValidDeployPosition(); SetBodygroup( 1, false ); // Find the teleport in the mothership CFuncMassTeleport *pTeleporter = NULL; while ( (pTeleporter = (CFuncMassTeleport*)gEntList.FindEntityByClassname( pTeleporter, "func_mass_teleport" )) != NULL ) { if ( pTeleporter->IsMCVTeleport() ) { m_hTeleportExit = pTeleporter; m_hTeleportExit->AddMCV( this ); break; } } // Put some flares down to mark the teleport zone Vector vecOrigin; QAngle vecAngles; for ( int i = 0; i < 4; i++ ) { char buf[64]; Q_snprintf( buf, 64, "teleport_corner%d", i+1 ); if ( GetAttachment( buf, vecOrigin, vecAngles ) ) { CheckBuildPoint( vecOrigin + Vector(0,0,64), Vector(0,0,128), &vecOrigin ); m_hTeleportCornerSprites[i] = CSprite::SpriteCreate( "sprites/redglow1.vmt", vecOrigin, false ); m_hTeleportCornerSprites[i]->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation ); m_hTeleportCornerSprites[i]->SetScale( 0.1 ); } } // Get the ray point if ( GetAttachment( "muzzle", vecOrigin, vecAngles ) ) { m_hTeleportCornerSprites[4] = CSprite::SpriteCreate( "sprites/redglow1.vmt", vecOrigin, false ); m_hTeleportCornerSprites[4]->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation ); m_hTeleportCornerSprites[4]->SetScale( 0.1 ); } SetContextThink( PostTeleportThink, gpGlobals->curtime + 0.1, TELEPORT_STATION_THINK_CONTEXT ); // Add ourselves to the list of deployed MCVs. s_DeployedTeleportStations.AddToTail( this ); // Set our vehicle bay screen's buildpoint for ( i = m_hScreens.Count(); --i >= 0; ) { if (m_hScreens[i].Get()) { CVGuiScreenVehicleBay *pScreen = dynamic_cast<CVGuiScreenVehicleBay*>( m_hScreens[0].Get() ); if ( pScreen ) { Vector vecOrigin; QAngle vecAngles; if ( GetAttachment( "vehiclebay", vecOrigin, vecAngles ) ) { pScreen->SetBuildPoint( vecOrigin, vecAngles ); } } } } SetControlPanelsActive( true ); SignalChangeInMCVSelectionPanels(); }
//----------------------------------------------------------------------------- // Purpose: Screens aren't active until deployed //----------------------------------------------------------------------------- void CVehicleTeleportStation::FinishedBuilding( void ) { BaseClass::FinishedBuilding(); SetControlPanelsActive( false ); }