//================================================================================ // Apaga y destruye la luz //================================================================================ void CInternalLight::TurnOff() { // No esta encendida if ( !IsOn() ) return; m_bIsOn = false; // Destruimos la luz if ( m_nLightHandle != CLIENTSHADOW_INVALID_HANDLE ) { g_pClientShadowMgr->DestroyFlashlight( m_nLightHandle ); m_nLightHandle = CLIENTSHADOW_INVALID_HANDLE; } #ifndef NO_TOOLFRAMEWORK if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "FlashlightState" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetInt( "entindex", m_iEntIndex ); msg->SetInt( "flashlightHandle", m_nLightHandle ); msg->SetPtr( "flashlightState", NULL ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } #endif }
//================================================================================ // Pensamiento //================================================================================ void CInternalLight::Update( const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp ) { VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING ); // No esta encendida if ( !IsOn() ) return; FlashlightState_t state; // Actualizamos el estado if ( !UpdateState( state, vecPos, vecForward, vecRight, vecUp ) ) return; // Actualizamos la proyección de la luz UpdateLightProjection( state ); #ifndef NO_TOOLFRAMEWORK if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "FlashlightState" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetInt( "entindex", m_iEntIndex ); msg->SetInt( "flashlightHandle", m_nLightHandle ); msg->SetPtr( "flashlightState", &state ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } #endif }
//----------------------------------------------------------------------------- // Refresh perforce information //----------------------------------------------------------------------------- void PerforceFileList::RefreshPerforceState( int nItemID, bool bFileExists, P4File_t *pFileInfo ) { KeyValues *kv = GetItem( nItemID ); bool bIsSynched = false; bool bIsFileInPerforce = (pFileInfo != NULL); if ( bIsFileInPerforce ) { if ( pFileInfo->m_bDeleted != bFileExists ) { bIsSynched = ( pFileInfo->m_bDeleted || ( pFileInfo->m_iHeadRevision == pFileInfo->m_iHaveRevision ) ); } } else { bIsSynched = !bFileExists; } bool bIsDeleted = bIsFileInPerforce && !bFileExists && pFileInfo->m_bDeleted; kv->SetInt( "in_perforce", bIsFileInPerforce ); kv->SetInt( "synched", bIsSynched ); kv->SetInt( "checked_out", bIsFileInPerforce && ( pFileInfo->m_eOpenState != P4FILE_UNOPENED ) ); kv->SetInt( "deleted", bIsDeleted ); if ( bIsDeleted ) { SetItemVisible( nItemID, m_bShowDeletedFiles ); } }
KeyValues *CNodeFinal::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetInt( "i_final_tonemap", i_tonemaptype ); pKV->SetInt( "i_final_wdepth", b_writedepth ? 1 : 0 ); return pKV; }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordPhysicsProp( const Vector& start, const QAngle &angles, const Vector& vel, int nModelIndex, int flags, int nSkin, int nEffects ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { const model_t* pModel = (nModelIndex != 0) ? modelinfo->GetModel( nModelIndex ) : NULL; const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : ""; KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_PHYSICS_PROP ); msg->SetString( "name", "TE_PhysicsProp" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "anglesx", angles.x ); msg->SetFloat( "anglesy", angles.y ); msg->SetFloat( "anglesz", angles.z ); msg->SetFloat( "velx", vel.x ); msg->SetFloat( "vely", vel.y ); msg->SetFloat( "velz", vel.z ); msg->SetString( "model", pModelName ); msg->SetInt( "breakmodel", flags ); msg->SetInt( "skin", nSkin ); msg->SetInt( "effects", nEffects ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
KeyValues* CASW_Reward::GetKeyValuesForEditor() { switch( m_RewardType ) { case ASW_REWARD_MONEY: { KeyValues *pReward = new KeyValues( "MoneyReward"); pReward->SetInt( NULL, m_iRewardAmount ); return pReward; } case ASW_REWARD_XP: { KeyValues *pReward = new KeyValues( "XPReward"); pReward->SetInt( NULL, m_iRewardAmount ); return pReward; } case ASW_REWARD_ITEM: { KeyValues *pReward = new KeyValues( "ItemReward"); pReward->SetString( "ItemName", m_szRewardName ); pReward->SetInt( "ItemLevel", m_iRewardLevel ); pReward->SetInt( "ItemQuality", m_iRewardQuality ); return pReward; } } return NULL; }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordMuzzleFlash( const Vector &start, const QAngle &angles, float scale, int type ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_MUZZLE_FLASH ); msg->SetString( "name", "TE_MuzzleFlash" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "anglesx", angles.x ); msg->SetFloat( "anglesy", angles.y ); msg->SetFloat( "anglesz", angles.z ); msg->SetFloat( "scale", scale ); msg->SetInt( "type", type ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // Purpose: expands a path //----------------------------------------------------------------------------- void DirectorySelectDialog::ExpandTreeNode(const char *path, int parentNodeIndex) { // set the small wait cursor surface()->SetCursor(dc_waitarrow); // get all the subfolders of the current drive char searchString[512]; sprintf(searchString, "%s*.*", path); FileFindHandle_t h; const char *pFileName = g_pFullFileSystem->FindFirstEx( searchString, NULL, &h ); for ( ; pFileName; pFileName = g_pFullFileSystem->FindNext( h ) ) { if ( !Q_stricmp( pFileName, ".." ) || !Q_stricmp( pFileName, "." ) ) continue; KeyValues *kv = new KeyValues("item"); kv->SetString("Text", pFileName); // set the folder image kv->SetInt("Image", 1); kv->SetInt("SelectedImage", 1); kv->SetInt("Expand", DoesDirectoryHaveSubdirectories(path, pFileName)); m_pDirTree->AddItem(kv, parentNodeIndex); } g_pFullFileSystem->FindClose( h ); }
void VMFExporter::AddRoomInstance( const CRoomTemplate *pRoomTemplate, int nPlacedRoomIndex ) { KeyValues *pFuncInstance = new KeyValues( "entity" ); pFuncInstance->SetInt( "id", ++ m_iEntityCount ); pFuncInstance->SetString( "classname", "func_instance" ); pFuncInstance->SetString( "angles", "0 0 0" ); // Used to identify rooms for later fixup (e.g. adding/swapping instances and models) if ( nPlacedRoomIndex != -1 ) { pFuncInstance->SetInt( "PlacedRoomIndex", nPlacedRoomIndex ); } char vmfName[MAX_PATH]; Q_snprintf( vmfName, sizeof( vmfName ), "tilegen/roomtemplates/%s/%s.vmf", pRoomTemplate->m_pLevelTheme->m_szName, pRoomTemplate->GetFullName() ); // Convert backslashes to forward slashes to please the VMF parser int nStrLen = Q_strlen( vmfName ); for ( int i = 0; i < nStrLen; ++ i ) { if ( vmfName[i] == '\\' ) vmfName[i] = '/'; } pFuncInstance->SetString( "file", vmfName ); Vector vOrigin = GetCurrentRoomOffset(); char buf[128]; Q_snprintf( buf, 128, "%f %f %f", vOrigin.x, vOrigin.y, vOrigin.z ); pFuncInstance->SetString( "origin", buf ); m_pExportKeys->AddSubKey( pFuncInstance ); }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordSprite( const Vector& start, int nModelIndex, float flScale, int nBrightness ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { const model_t* pModel = (nModelIndex != 0) ? modelinfo->GetModel( nModelIndex ) : NULL; const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : ""; KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_SPRITE_SINGLE ); msg->SetString( "name", "TE_Sprite" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetString( "model", pModelName ); msg->SetFloat( "scale", flScale ); msg->SetInt( "brightness", nBrightness ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
void CViewAngleAnimation::SaveAsAnimFile( const char *pKeyFrameFileName ) { // save all of our keyframes into the file KeyValues *pData = new KeyValues( pKeyFrameFileName ); pData->SetInt( "flags", m_iFlags ); KeyValues *pKey = new KeyValues( "keyframe" ); int i; int c = m_KeyFrames.Count(); char buf[64]; for ( i=0;i<c;i++ ) { pKey = pData->CreateNewKey(); Q_snprintf( buf, sizeof(buf), "%f %f %f", m_KeyFrames[i]->m_vecAngles[0], m_KeyFrames[i]->m_vecAngles[1], m_KeyFrames[i]->m_vecAngles[2] ); pKey->SetString( "angles", buf ); pKey->SetFloat( "time", m_KeyFrames[i]->m_flTime ); pKey->SetInt( "flags", m_KeyFrames[i]->m_iFlags ); } pData->SaveToFile( filesystem, pKeyFrameFileName, NULL ); pData->deleteThis(); }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordBloodSprite( const Vector &start, const Vector &direction, int r, int g, int b, int a, int nSprayModelIndex, int nDropModelIndex, int size ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { Color clr( r, g, b, a ); const model_t* pSprayModel = (nSprayModelIndex != 0) ? modelinfo->GetModel( nSprayModelIndex ) : NULL; const model_t* pDropModel = (nDropModelIndex != 0) ? modelinfo->GetModel( nDropModelIndex ) : NULL; const char *pSprayModelName = pSprayModel ? modelinfo->GetModelName( pSprayModel ) : ""; const char *pDropModelName = pDropModel ? modelinfo->GetModelName( pDropModel ) : ""; KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_BLOOD_SPRITE ); msg->SetString( "name", "TE_BloodSprite" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "directionx", direction.x ); msg->SetFloat( "directiony", direction.y ); msg->SetFloat( "directionz", direction.z ); msg->SetColor( "color", clr ); msg->SetString( "spraymodel", pSprayModelName ); msg->SetString( "dropmodel", pDropModelName ); msg->SetInt( "size", size ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
KeyValues *CNodeMCompose::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetInt( "i_mcomp_matrix", iTargetMatrix ); pKV->SetInt( "i_mcomp_c", bColumns ? 1 : 0 ); return pKV; }
//----------------------------------------------------------------------------- // initialization, shutdown //----------------------------------------------------------------------------- bool CProceduralTexturePanel::Init( int nWidth, int nHeight, bool bAllocateImageBuffer ) { m_nWidth = nWidth; m_nHeight = nHeight; if ( bAllocateImageBuffer ) { m_pImageBuffer = new BGRA8888_t[nWidth * nHeight]; } m_TextureSubRect.x = m_TextureSubRect.y = 0; m_TextureSubRect.width = nWidth; m_TextureSubRect.height = nHeight; char pTemp[512]; Q_snprintf( pTemp, 512, "__%s", GetName() ); ITexture *pTex = MaterialSystem()->CreateProceduralTexture( pTemp, TEXTURE_GROUP_VGUI, m_nWidth, m_nHeight, IMAGE_FORMAT_BGRX8888, TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_PROCEDURAL | TEXTUREFLAGS_SINGLECOPY ); pTex->SetTextureRegenerator( this ); m_ProceduralTexture.Init( pTex ); KeyValues *pVMTKeyValues = new KeyValues( "UnlitGeneric" ); pVMTKeyValues->SetString( "$basetexture", pTemp ); pVMTKeyValues->SetInt( "$nocull", 1 ); pVMTKeyValues->SetInt( "$nodebug", 1 ); m_ProceduralMaterial.Init( MaterialSystem()->CreateMaterial( pTemp, pVMTKeyValues )); m_nTextureID = MatSystemSurface()->CreateNewTextureID( false ); MatSystemSurface()->DrawSetTextureMaterial( m_nTextureID, m_ProceduralMaterial ); return true; }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordSparks( const Vector &start, int nMagnitude, int nTrailLength, const Vector &direction ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_SPARKS ); msg->SetString( "name", "TE_Sparks" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "directionx", direction.x ); msg->SetFloat( "directiony", direction.y ); msg->SetFloat( "directionz", direction.z ); msg->SetInt( "magnitude", nMagnitude ); msg->SetInt( "traillength", nTrailLength ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
FOR_EACH_VEC(m_vLocalTimes, i) { Time t = m_vLocalTimes[i]; //MOM_TODO: consider adding a "100 tick" column? KeyValues *kvLocalTimeFormatted = new KeyValues("localtime"); kvLocalTimeFormatted->SetFloat("time_f", t.time_sec);//Used for static compare kvLocalTimeFormatted->SetInt("date_t", t.date);//Used for finding char timeString[BUFSIZETIME]; mom_UTIL->FormatTime(t.time_sec, timeString); kvLocalTimeFormatted->SetString("time", timeString); char dateString[64]; tm *local; local = localtime(&t.date); if (local) { strftime(dateString, sizeof(dateString), "%d/%m/%Y %H:%M:%S", local); kvLocalTimeFormatted->SetString("date", dateString); } else kvLocalTimeFormatted->SetInt("date", t.date); kvInto->AddSubKey(kvLocalTimeFormatted); }
//--------------------------------------------------------------------------------- // Purpose: Take a string, remove carriage return, remove comments, strips leading // and ending spaces //--------------------------------------------------------------------------------- void ClientMsgSinglePlayer ( edict_t *pEntity, const unsigned int seconds, const int level, const char* fmt, ... ) { tchar szBuf[256]; va_list arg_ptr; va_start(arg_ptr, fmt); vsnprintf(szBuf, sizeof(szBuf)-1, fmt, arg_ptr); va_end(arg_ptr); szBuf[sizeof(szBuf)-1] = 0; KeyValues *kv = new KeyValues("Msg"); kv->SetString("title", szBuf); kv->SetString("Msg", "message"); kv->SetColor("color", Color(255, 255, 255, 255)); // White kv->SetInt("level", level); kv->SetInt("time", seconds); helpers->CreateMessage(pEntity, DIALOG_MSG, kv, gpManiISPCCallback); kv->deleteThis(); }
KeyValues *CNodeStdVLight::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetInt( "i_vlight_static", m_bStaticLighting ? 1 : 0 ); pKV->SetInt( "i_vlight_hl", m_bHalfLambert ? 1 : 0 ); return pKV; }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordDecal( const Vector &pos, const Vector &start, int entity, int hitbox, int index ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { // FIXME: Can't record on entities yet if ( entity != 0 ) return; KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_DECAL ); msg->SetString( "name", "TE_Decal" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", pos.x ); msg->SetFloat( "originy", pos.y ); msg->SetFloat( "originz", pos.z ); msg->SetFloat( "startx", start.x ); msg->SetFloat( "starty", start.y ); msg->SetFloat( "startz", start.z ); msg->SetInt( "hitbox", hitbox ); msg->SetString( "decalname", effects->Draw_DecalNameFromIndex( index ) ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//--------------------------------------------------------------------------------- // Purpose: Take a string, remove carriage return, remove comments, strips leading // and ending spaces //--------------------------------------------------------------------------------- void ClientMsg ( Color *col, const unsigned int seconds, const bool admin_only, const int level, const char* fmt, ... ) { player_t player; tchar szBuf[256]; va_list arg_ptr; va_start(arg_ptr, fmt); vsnprintf(szBuf, sizeof(szBuf)-1, fmt, arg_ptr); va_end(arg_ptr); Color admin_only_colour(255, 0, 0, 255); szBuf[sizeof(szBuf)-1] = 0; for (int i = 1; i <= max_players; i++ ) { player.index = i; if (!FindPlayerByIndex (&player)) { continue; } if (player.is_bot) { continue; } if (admin_only) { if (gpManiClient->HasAccess(player.index, ADMIN, ADMIN_BASIC_ADMIN)) { KeyValues *kv = new KeyValues("Msg"); kv->SetString("title", szBuf); kv->SetString("Msg", "message"); kv->SetColor("color", admin_only_colour); // Red kv->SetInt("level", level); kv->SetInt("time", seconds); helpers->CreateMessage(player.entity, DIALOG_MSG, kv, gpManiISPCCallback); kv->deleteThis(); } } else { KeyValues *kv = new KeyValues("Msg"); kv->SetString("title", szBuf); kv->SetString("Msg", "message"); kv->SetColor("color", *col); kv->SetInt("level", level); kv->SetInt("time", seconds); helpers->CreateMessage(player.entity, DIALOG_MSG, kv, gpManiISPCCallback); kv->deleteThis(); } } }
//----------------------------------------------------------------------------- // Creates, destroys a test material //----------------------------------------------------------------------------- void CMaterialSystemTestApp::CreateWireframeMaterial() { KeyValues *pVMTKeyValues = new KeyValues( "Wireframe" ); pVMTKeyValues->SetInt( "$vertexcolor", 1 ); pVMTKeyValues->SetInt( "$nocull", 1 ); pVMTKeyValues->SetInt( "$ignorez", 1 ); m_pMaterial.Init( "__test", pVMTKeyValues ); }
KeyValues *CNodePSOutput::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetInt( "numColors", curSetup.iNumRTs ); pKV->SetInt( "enable_Depth", ( curSetup.bDepth ? 1 : 0 ) ); return pKV; }
void CNB_MOD_Level_Building::PerformLayout() { KeyValues *pKV = new KeyValues( "ItemModelPanel" ); pKV->SetInt( "fov", 20 ); pKV->SetInt( "start_framed", 0 ); pKV->SetInt( "disable_manipulation", 1 ); BaseClass::PerformLayout(); }
void CNB_Weapon_Unlocked::PerformLayout() { KeyValues *pKV = new KeyValues( "ItemModelPanel" ); pKV->SetInt( "fov", 20 ); pKV->SetInt( "start_framed", 0 ); pKV->SetInt( "disable_manipulation", 1 ); m_pItemModelPanel->ApplySettings( pKV ); BaseClass::PerformLayout(); }
//----------------------------------------------------------------------------- // Purpose: Saves the version information chunk. // Input : *pFile - // Output : Returns ChunkFile_Ok on success, an error code on failure. //----------------------------------------------------------------------------- KeyValues* VMFExporter::GetVersionInfo() { KeyValues *pKeys = new KeyValues( "versioninfo" ); pKeys->SetInt( "editorversion", 400 ); pKeys->SetInt( "editorbuild", 3900 ); pKeys->SetInt( "mapversion", 1 ); pKeys->SetInt( "formatversion", 100 ); pKeys->SetBool( "prefab", false ); return pKeys; }
void CGameUI::SendConnectedToGameMessage() { MEM_ALLOC_CREDIT(); KeyValues *kv = new KeyValues( "ConnectedToGame" ); kv->SetInt( "ip", m_iGameIP ); kv->SetInt( "connectionport", m_iGameConnectionPort ); kv->SetInt( "queryport", m_iGameQueryPort ); g_VModuleLoader.PostMessageToAllModules( kv ); }
void CNB_Lobby_Tooltip::PerformLayout() { BaseClass::PerformLayout(); KeyValues *pKV = new KeyValues( "ItemModelPanel" ); pKV->SetInt( "fov", 20 ); pKV->SetInt( "start_framed", 0 ); pKV->SetInt( "disable_manipulation", 1 ); m_pItemModelPanel->ApplySettings( pKV ); }
void CCode_Editor::ApplyCode( bool bDoInject ) { if ( m_iMode == CSmartText::CODEEDITMODE_HLSL ) { text_cursor start( 0, 0 ); text_cursor end( 0, m_pCodeWindow->GetLockedRow( 1 ) - 1 ); m_pCodeWindow->MoveCursorToEndOfRow( -1, &end ); text_cursor start_body( 0, m_pCodeWindow->GetLockedRow( 2 ) + 1 ); text_cursor end_body( 0, m_pCodeWindow->GetLockedRow( 3 ) - 1 ); m_pCodeWindow->MoveCursorToEndOfRow( -1, &end_body ); m_pCodeWindow->ClearDynamicSpacing(); char *pGlobal = ReadSnippet( start, end ); char *pBody = ReadSnippet( start_body, end_body ); KeyValues *pCodeMsg = new KeyValues("CodeUpdate"); if ( pGlobal && Q_strlen( pGlobal ) ) CKVPacker::KVPack( pGlobal, "szcode_global", pCodeMsg ); //pCodeMsg->SetString( "szcode_global", pGlobal ); if ( pBody && Q_strlen( pBody ) ) CKVPacker::KVPack( pBody, "szcode_body", pCodeMsg ); //pCodeMsg->SetString( "szcode_body", pBody ); pCodeMsg->SetInt( "doinject", bDoInject ? 1 : 0 ); PostActionSignal( pCodeMsg ); delete [] pGlobal; delete [] pBody; } else if ( m_iMode == CSmartText::CODEEDITMODE_VMT ) { text_cursor start( 0, 0 ); text_cursor end( -1, -1 ); m_pCodeWindow->MoveCursorToEndOfText( &end ); m_pCodeWindow->ClearDynamicSpacing(); char *pVMT = ReadSnippet( start, end ); KeyValues *pVMTMsg = new KeyValues("CodeUpdate"); if ( pVMT ) CKVPacker::KVPack( pVMT, "szVMTString", pVMTMsg ); //pVMTMsg->SetString( "szVMTString", pVMT ); pVMTMsg->SetInt( "doinject", bDoInject ? 1 : 0 ); PostActionSignal( pVMTMsg ); delete [] pVMT; } else Assert(0); m_iLastAppliedCodeIndex = m_pCodeWindow->GetCurrentHistoryIndex(); UpdateButtonEnabled( true, false ); }
//----------------------------------------------------------------------------- // Purpose: Do the headlight //----------------------------------------------------------------------------- void CFlashlightEffect::UpdateLight( int nEntIdx, const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp, float flFov, float flFarZ, float flLinearAtten, bool castsShadows, const char* pTextureName ) { VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING ); m_nEntIndex = nEntIdx; m_flFov = flFov; m_flFarZ = flFarZ; m_flLinearAtten = flLinearAtten; if ( m_bCastsShadows != castsShadows ) { // requires recreation of the flashlight LightOff(); } m_bCastsShadows = castsShadows; UpdateFlashlightTexture( pTextureName ); FlashlightState_t state; if ( UpdateDefaultFlashlightState( state, vecPos, vecForward, vecRight, vecUp, castsShadows ) == false ) { return; } if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE ) { m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state ); } else { if( !r_flashlightlockposition.GetBool() ) { g_pClientShadowMgr->UpdateFlashlightState( m_FlashlightHandle, state ); } } g_pClientShadowMgr->UpdateProjectedTexture( m_FlashlightHandle, true ); #ifndef NO_TOOLFRAMEWORK if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "FlashlightState" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetInt( "entindex", m_nEntIndex ); msg->SetInt( "flashlightHandle", m_FlashlightHandle ); msg->SetPtr( "flashlightState", &state ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } #endif }
//----------------------------------------------------------------------------- // Purpose: Passes the message up to the default handler to be dispatched //----------------------------------------------------------------------------- bool CServerSession::ReceivedMsg_DefaultHandler(IReceiveMessage *msg) { // unpack the message // need to turn the msg id into a name KeyValues *dat = new KeyValues("msg"); dat->SetInt("_id", msg->GetMsgID()); ::GetDoc()->ReadIn(dat, msg); dat->SetInt("IP", msg->NetAddress().IP()); dat->SetInt("Port", msg->NetAddress().Port()); return DispatchMessageToWatchers(dat); }