//----------------------------------------------------------------------------- // 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(); } }
//----------------------------------------------------------------------------- // 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(); } }
void InventoryItem::OnMouseWheeled(int delta) { bool bScrollingUp = (delta > 0); if (!m_bWantsToRotate) { m_flOriginX += (bScrollingUp ? -1 : 1); KeyValues *pkvChar = GameBaseClient->GetInventoryItemDetails(GameBaseClient->pszInventoryList[GetControlID()].inventoryItem); if (pkvChar) { KeyValues *pkvModelField = pkvChar->FindKey("ModelData"); if (pkvModelField) { KeyValues *pkvModel = pkvModelField->FindKey("Model"); if (pkvModel) { pkvModel->SetFloat("origin_x", m_flOriginX); pkvModel->SetFloat("angles_y", m_flAngleY); m_pModelPreview->ParseModelInfo(pkvModel); } } pkvChar->deleteThis(); } } BaseClass::OnMouseWheeled(delta); }
//----------------------------------------------------------------------------- // 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(); } }
//----------------------------------------------------------------------------- // 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 *CBaseContainerNode::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetFloat( "container_extents_x", m_vecContainerExtents.x ); pKV->SetFloat( "container_extents_y", m_vecContainerExtents.y ); pKV->SetFloat( "container_extents_z", m_vecContainerExtents.z ); return pKV; }
void InventoryItem::OnThink() { BaseClass::OnThink(); // If we want to rotate then we'll keep track of the users movement with the mouse (coords) in order to update the position. if (m_bWantsToRotate) { // When the cursor goes out of our control bounds then OnMouseReleased will no longer record the mouse input, which means we need to use this function: if (!g_pInputSystem->IsButtonDown(MOUSE_RIGHT)) { m_bWantsToRotate = false; return; } int x, y; vgui::input()->GetCursorPos(x, y); if (x != m_iOriginalCursorXPos) { int iDiff = x - m_iOriginalCursorXPos; m_flAngleY += iDiff; // Clamp the angle between 0 - 360 degrees. if (m_flAngleY > 360) m_flAngleY = 0; else if (m_flAngleY < 0) m_flAngleY = 360; KeyValues *pkvChar = GameBaseClient->GetInventoryItemDetails(GameBaseClient->pszInventoryList[GetControlID()].inventoryItem); if (pkvChar) { KeyValues *pkvModelField = pkvChar->FindKey("ModelData"); if (pkvModelField) { KeyValues *pkvModel = pkvModelField->FindKey("Model"); if (pkvModel) { pkvModel->SetFloat("origin_x", m_flOriginX); pkvModel->SetFloat("angles_y", m_flAngleY); m_pModelPreview->ParseModelInfo(pkvModel); } } pkvChar->deleteThis(); } m_iOriginalCursorXPos = x; } } }
void CTileGenDialog::GenerateRoomThumbnails( bool bAddToPerforce ) { // save out a keyvalues file with position/size of each room KeyValues *pKV = new KeyValues( "RoomThumbnails" ); char filename[MAX_PATH]; for ( int i=0;i<m_pMapLayout->m_PlacedRooms.Count();i++ ) { CRoom *pRoom = m_pMapLayout->m_PlacedRooms[i]; if ( !pRoom ) continue; KeyValues *pkvEntry = new KeyValues( "Thumbnail" ); Q_snprintf( filename, sizeof( filename ), "tilegen/roomtemplates/%s/%s.tga", pRoom->m_pRoomTemplate->m_pLevelTheme->m_szName, pRoom->m_pRoomTemplate->GetFullName() ); pkvEntry->SetString( "Filename", filename ); int half_map_size = MAP_LAYOUT_TILES_WIDE * 0.5f; // shift back so the middle of our grid is the origin float xPos = (pRoom->m_iPosX - half_map_size) * ASW_TILE_SIZE; float yPos = (pRoom->m_iPosY - half_map_size) * ASW_TILE_SIZE; pkvEntry->SetFloat( "RoomX", xPos ); pkvEntry->SetFloat( "RoomY", yPos + pRoom->m_pRoomTemplate->GetTilesY() * ASW_TILE_SIZE ); pkvEntry->SetFloat( "RoomWide", pRoom->m_pRoomTemplate->GetTilesX() * ASW_TILE_SIZE ); pkvEntry->SetFloat( "RoomTall", pRoom->m_pRoomTemplate->GetTilesY() * ASW_TILE_SIZE ); pkvEntry->SetFloat( "OutputWide", pRoom->m_pRoomTemplate->GetTilesX() * RoomTemplatePanelTileSize() ); pkvEntry->SetFloat( "OutputTall", pRoom->m_pRoomTemplate->GetTilesY() * RoomTemplatePanelTileSize() ); pKV->AddSubKey( pkvEntry ); } if ( !pKV->SaveToFile( g_pFullFileSystem, THUMBNAILS_FILE, "GAME" ) ) { Msg( "Error: Couldn't save %s\n", THUMBNAILS_FILE ); pKV->deleteThis(); return; } pKV->deleteThis(); m_pMapLayout->SaveMapLayout( "maps/output.layout" ); if ( engine ) { char buffer[256]; Q_snprintf(buffer, sizeof(buffer), "asw_random_weapons 0; asw_building_room_thumbnails 1; asw_add_room_thumbnails_to_perforce %d; asw_build_map %s", bAddToPerforce ? 1 : 0, "output.layout" ); engine->ClientCmd_Unrestricted( buffer ); } }
//================================================================================ // 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 }
//Called every time a new time is achieved void CTimer::SaveTime() { const char *szMapName = gpGlobals->mapname.ToCStr(); KeyValues *timesKV = new KeyValues(szMapName); int count = localTimes.Count(); for (int i = 0; i < count; i++) { Time t = localTimes[i]; char timeName[512]; Q_snprintf(timeName, 512, "%i", t.ticks); KeyValues *pSubkey = new KeyValues(timeName); pSubkey->SetFloat("rate", t.tickrate); pSubkey->SetInt("date", t.date); timesKV->AddSubKey(pSubkey); } char file[MAX_PATH]; Q_strcpy(file, c_mapDir); Q_strcat(file, szMapName, MAX_PATH); Q_strncat(file, c_timesExt, MAX_PATH); if (timesKV->SaveToFile(filesystem, file, "MOD", true)) { Log("Successfully saved new time!\n"); IGameEvent *savedEvent = gameeventmanager->CreateEvent("runtime_saved"); if (savedEvent) gameeventmanager->FireEvent(savedEvent); } timesKV->deleteThis(); }
// sets priority of objective entities based on the order the rooms were listed in the mission/objective txt void VMFExporter::ReorderObjectives( const CRoomTemplate *pTemplate, KeyValues *pTemplateKeys ) { KeyValues *pKeys = m_pTemplateKeys; while ( pKeys ) { if ( !Q_stricmp( pKeys->GetName(), "entity" ) && !Q_strnicmp( pKeys->GetString( "classname" ), "asw_objective", 13 ) ) { if ( pKeys->GetFloat( "Priority" ) != 0 ) // if level designer has already set priority, then don't override it { pKeys = pKeys->GetNextKey(); continue; } int iPriority = 100; // We no longer have a requested rooms array, so this code is not valid. Need to replace it with something else to ensure priorities are set correctly. // for ( int i = 0; i < m_pMapLayout->m_pRequestedRooms.Count(); i++ ) // { // if ( m_pMapLayout->m_pRequestedRooms[i]->m_pRoomTemplate == pTemplate ) // { // iPriority = m_pMapLayout->m_pRequestedRooms[i]->m_iMissionTextOrder; // } // } pKeys->SetFloat( "Priority", iPriority ); } pKeys = pKeys->GetNextKey(); } }
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); }
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(); }
//================================================================================ // 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 }
//----------------------------------------------------------------------------- // VMT parser //----------------------------------------------------------------------------- static void InsertKeyValues( KeyValues &dst, KeyValues& src, bool bCheckForExistence ) { KeyValues *pSrcVar = src.GetFirstSubKey(); while( pSrcVar ) { if ( !bCheckForExistence || dst.FindKey( pSrcVar->GetName() ) ) { switch( pSrcVar->GetDataType() ) { case KeyValues::TYPE_STRING: dst.SetString( pSrcVar->GetName(), pSrcVar->GetString() ); break; case KeyValues::TYPE_INT: dst.SetInt( pSrcVar->GetName(), pSrcVar->GetInt() ); break; case KeyValues::TYPE_FLOAT: dst.SetFloat( pSrcVar->GetName(), pSrcVar->GetFloat() ); break; case KeyValues::TYPE_PTR: dst.SetPtr( pSrcVar->GetName(), pSrcVar->GetPtr() ); break; } } pSrcVar = pSrcVar->GetNextKey(); } }
//----------------------------------------------------------------------------- // 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 *CNodeRandom::AllocateKeyValues( int NodeIndex ) { KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex ); pKV->SetInt( "i_num_comps", m_iNumComponents ); pKV->SetFloat( "fl_value_min", m_flValue_Min ); pKV->SetFloat( "fl_value_max", m_flValue_Max ); return pKV; }
void Destructible::SendDestroyedEvent() { KeyValues *event = new KeyValues("object_destroyed"); event->SetString("object_name", GetEntityClassName()); event->SetString("object_class", GetEntityResourceClass()); event->SetInt("score", data.score); event->SetFloat("x", GetOrigin().x); event->SetFloat("y", GetOrigin().y); Events::GetInstance()->FireEvent(event); }
bool CBaseGameStats_Driver::AddBaseDataForSend( KeyValues *pKV, StatSendType_t sendType ) { switch ( sendType ) { case STATSEND_APPSHUTDOWN: #ifdef CLIENT_DLL if ( m_iNumLevels > 0 ) { // add playtime data KeyValues *pKVData = new KeyValues( "playtime" ); pKVData->SetInt( "TotalLevelTime", m_flTotalTimeInLevels ); pKVData->SetInt( "NumLevels", m_iNumLevels ); pKV->AddSubKey( pKVData ); return true; } #endif break; case STATSEND_LEVELSHUTDOWN: #ifdef CLIENT_DLL if ( m_bBufferFull ) { // add perf data KeyValues *pKVPerf = new KeyValues( "perfdata" ); float flAverageFrameRate = AverageStat( &StatsBufferRecord_t::m_flFrameRate ); float flMinFrameRate = MinStat( &StatsBufferRecord_t::m_flFrameRate ); float flMaxFrameRate = MaxStat( &StatsBufferRecord_t::m_flFrameRate ); pKVPerf->SetFloat( "AvgFPS", flAverageFrameRate ); pKVPerf->SetFloat( "MinFPS", flMinFrameRate ); pKVPerf->SetFloat( "MaxFPS", flMaxFrameRate ); pKV->AddSubKey( pKVPerf ); return true; } #endif break; } return false; }
//----------------------------------------------------------------------------- // Shared code //----------------------------------------------------------------------------- static inline void RecordWorldDecal( const Vector *pos, int index ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_WORLD_DECAL ); msg->SetString( "name", "TE_WorldDecal" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", pos->x ); msg->SetFloat( "originy", pos->y ); msg->SetFloat( "originz", pos->z ); msg->SetString( "decalname", effects->Draw_DecalNameFromIndex( index ) ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // 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 }
//----------------------------------------------------------------------------- // 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(); } }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- void C_TEExplosion::RecordExplosion( ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { const model_t* pModel = (m_nModelIndex != 0) ? modelinfo->GetModel( m_nModelIndex ) : NULL; const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : ""; KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_EXPLOSION ); msg->SetString( "name", "TE_Explosion" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", m_vecOrigin.x ); msg->SetFloat( "originy", m_vecOrigin.y ); msg->SetFloat( "originz", m_vecOrigin.z ); msg->SetFloat( "directionx", m_vecNormal.x ); msg->SetFloat( "directiony", m_vecNormal.y ); msg->SetFloat( "directionz", m_vecNormal.z ); msg->SetString( "model", pModelName ); msg->SetFloat( "scale", m_fScale ); msg->SetInt( "framerate", m_nFrameRate ); msg->SetInt( "flags", m_nFlags ); msg->SetInt( "materialtype", m_chMaterialType ); msg->SetInt( "radius", m_nRadius ); msg->SetInt( "magnitude", m_nMagnitude ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordSmoke( const Vector &start, float flScale, int nFrameRate ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_SMOKE ); msg->SetString( "name", "TE_Smoke" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "scale", flScale ); msg->SetInt( "framerate", nFrameRate ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordBreakModel( const Vector &start, const QAngle &angles, const Vector &size, const Vector &vel, int nModelIndex, int nRandomization, int nCount, float flDuration, int nFlags ) { 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_BREAK_MODEL ); msg->SetString( "name", "TE_BreakModel" ); 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( "sizex", size.x ); msg->SetFloat( "sizey", size.y ); msg->SetFloat( "sizez", size.z ); msg->SetFloat( "velx", vel.x ); msg->SetFloat( "vely", vel.y ); msg->SetFloat( "velz", vel.z ); msg->SetString( "model", pModelName ); msg->SetInt( "randomization", nRandomization ); msg->SetInt( "count", nCount ); msg->SetFloat( "duration", flDuration ); msg->SetInt( "flags", nFlags ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordConcussiveExplosion( const Vector& start, const Vector &vecDirection ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_CONCUSSIVE_EXPLOSION ); msg->SetString( "name", "TE_ConcussiveExplosion" ); msg->SetFloat( "time", gpGlobals->curtime ); msg->SetFloat( "originx", start.x ); msg->SetFloat( "originy", start.y ); msg->SetFloat( "originz", start.z ); msg->SetFloat( "directionx", vecDirection.x ); msg->SetFloat( "directiony", vecDirection.y ); msg->SetFloat( "directionz", vecDirection.z ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
//----------------------------------------------------------------------------- // Recording //----------------------------------------------------------------------------- static inline void RecordArmorRicochet( const Vector &start, const Vector &direction ) { if ( !ToolsEnabled() ) return; if ( clienttools->IsInRecordingMode() ) { KeyValues *msg = new KeyValues( "TempEntity" ); msg->SetInt( "te", TE_ARMOR_RICOCHET ); msg->SetString( "name", "TE_ArmorRicochet" ); 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 ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg ); msg->deleteThis(); } }
void CBaseGameStats_Driver::ResetData() { #ifdef GAME_DLL // on the server, if there is a gamestats data container registered (by a client in the same process), they're in charge of resetting it, nothing for us to do if ( engine->GetGamestatsData() != NULL ) return; #endif if ( m_pGamestatsData != NULL ) { delete m_pGamestatsData; m_pGamestatsData = NULL; } m_pGamestatsData = new CGamestatsData(); KeyValues *pKV = m_pGamestatsData->m_pKVData; pKV->SetInt( "version", GAMESTATS_VERSION ); pKV->SetString( "srcid", s_szPseudoUniqueID ); #ifdef CLIENT_DLL const CPUInformation &cpu = GetCPUInformation(); OverWriteCharsWeHate( cpu.m_szProcessorID ); pKV->SetString( "CPUID", cpu.m_szProcessorID ); pKV->SetFloat( "CPUGhz", cpu.m_Speed * ( 1.0 / 1.0e9 ) ); pKV->SetInt( "NumCores", cpu.m_nPhysicalProcessors ); MaterialAdapterInfo_t gpu; materials->GetDisplayAdapterInfo( materials->GetCurrentAdapter(), gpu ); CMatRenderContextPtr pRenderContext( materials ); int dest_width,dest_height; pRenderContext->GetRenderTargetDimensions( dest_width, dest_height ); if ( gpu.m_pDriverName ) { OverWriteCharsWeHate( gpu.m_pDriverName ); } pKV->SetString( "GPUDrv", SafeString( gpu.m_pDriverName ) ); pKV->SetInt( "GPUVendor", gpu.m_VendorID ); pKV->SetInt( "GPUDeviceID", gpu.m_DeviceID ); pKV->SetString( "GPUDriverVersion", CFmtStr( "%d.%d", gpu.m_nDriverVersionHigh, gpu.m_nDriverVersionLow ) ); pKV->SetInt( "DxLvl", g_pMaterialSystemHardwareConfig->GetDXSupportLevel() ); pKV->SetInt( "Width", dest_width ); pKV->SetInt( "Height", dest_height ); engine->SetGamestatsData( m_pGamestatsData ); #endif }
/* CUtlVector< SimpleTexture* > hList_Textures; CUtlVector< SimpleCombo* > hList_Combos; CUtlVector< SimpleEnvConstant* > hList_EConstants; */ void df_SaveDump_File( const char *canvasname, const BasicShaderCfg_t &shader ) { KeyValues *pKV = new KeyValues( canvasname ); char _path[MAX_PATH]; Q_snprintf( _path, MAX_PATH, "%s/%s.dump", ::GetDumpDirectory(), canvasname ); Q_FixSlashes( _path ); pKV->SetString( "vs_name", shader.ProcVSName ); pKV->SetString( "ps_name", shader.ProcPSName ); pKV->SetString( "shader_filename", shader.Filename ); pKV->SetString( GetDumpVersion_KeyName(), GetDumpVersion_Current() ); pKV->SetInt( "i_sm", shader.iShaderModel ); pKV->SetInt( "i_cull", shader.iCullmode ); pKV->SetInt( "i_ablend", shader.iAlphablendmode ); pKV->SetFloat( "fl_atestref", shader.flAlphaTestRef ); pKV->SetInt( "i_dtest", shader.iDepthtestmode ); pKV->SetInt( "i_dwrite", shader.iDepthwritemode ); pKV->SetInt( "i_srgbw", shader.bsRGBWrite ? 1 : 0 ); pKV->SetInt( "i_vfmt_flags", shader.iVFMT_flags ); pKV->SetInt( "i_vfmt_texcoords", shader.iVFMT_numTexcoords ); pKV->SetInt( "i_vfmt_udata", shader.iVFMT_numUserData ); for ( int i = 0; i < 3; i++ ) { char tmp[48]; Q_snprintf( tmp, sizeof(tmp), "i_vfmt_texcoordDim_%i", i ); pKV->SetInt( tmp, shader.iVFMT_texDim[i] ); } pKV->SetInt( "i_vlit", shader.bVertexLighting ); pKV->SetInt( "i_vrefract", shader.bRefractionSupport ); KeyValues *pKVIdentVS = __AllocKV_Identifiers( shader.pVS_Identifiers ); pKVIdentVS->SetName( "identifiers_VS" ); pKV->AddSubKey( pKVIdentVS ); KeyValues *pKVIdentPS = __AllocKV_Identifiers( shader.pPS_Identifiers ); pKVIdentPS->SetName( "identifiers_PS" ); pKV->AddSubKey( pKVIdentPS ); pKV->SaveToFile( g_pFullFileSystem, _path, "MOD" ); pKV->deleteThis(); }
/* // custom parameter - uniquify this char *szParamName; // sampler index - defined on uniquify int iSamplerIndex; // texture mode, bind standard or from param? int iTextureMode; // do we need a cubemap lookup? bool bCubeTexture; bool bSRGB; */ KeyValues *__AllocKV_EConst( int i, SimpleEnvConstant *c ) { char tmp[MAX_PATH]; Q_snprintf( tmp, MAX_PATH, "econst_%i", i ); KeyValues *pKV = new KeyValues( tmp ); pKV->SetInt( "i_envconstidx", c->iEnvC_ID ); pKV->SetInt( "i_normregister", c->iHLSLRegister ); pKV->SetInt( "i_econstsize", c->iConstSize ); pKV->SetInt( "i_smartcomps", c->iSmartNumComps ); pKV->SetString( "sz_smartname", c->szSmartHelper ); for ( int i = 0; i < 4; i++ ) { char tmpdef[MAX_PATH]; Q_snprintf( tmpdef, MAX_PATH, "fl_smartdefault_%02i", i ); pKV->SetFloat( tmpdef, c->flSmartDefaultValues[ i ] ); } return pKV; }