diff --git a/src/common/imageutils.cpp b/src/common/imageutils.cpp index 6038ad5b9f3..49c56a966ed 100644 --- a/src/common/imageutils.cpp +++ b/src/common/imageutils.cpp @@ -1359,16 +1359,16 @@ ConversionErrorType ImgUtl_ConvertTGAToVTF(const char *tgaPath, int nMaxWidth/*= return CE_ERROR_LOADING_DLL; } - char *vtfParams[4]; + const char *vtfParams[4]; // the 0th entry is skipped cause normally thats the program name. vtfParams[0] = ""; vtfParams[1] = "-quiet"; vtfParams[2] = "-dontusegamedir"; - vtfParams[3] = (char *)tgaPath; + vtfParams[3] = tgaPath; // call vtex to do the conversion. - vtex->VTex(4, vtfParams); // how do we know this works? + vtex->VTex(4, const_cast(vtfParams)); // how do we know this works? Sys_UnloadModule(vtexmod); diff --git a/src/fgdlib/gamedata.cpp b/src/fgdlib/gamedata.cpp index 3d1d75e67df..e6239861094 100644 --- a/src/fgdlib/gamedata.cpp +++ b/src/fgdlib/gamedata.cpp @@ -91,7 +91,7 @@ static bool DoGetToken(TokenReader &tr, char **ppszStore, int nSize, trtoken_t t // We didn't get the expected token type but no expected // string was specified. // - char *pszTokenName; + const char *pszTokenName; switch (ttexpecting) { case IDENT: diff --git a/src/fgdlib/gdvar.cpp b/src/fgdlib/gdvar.cpp index 80c0d863a4e..cd9e3b10827 100644 --- a/src/fgdlib/gdvar.cpp +++ b/src/fgdlib/gdvar.cpp @@ -14,7 +14,7 @@ typedef struct { GDIV_TYPE eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. trtoken_t eStoreAs; // How this type is stored (STRING, INTEGER, etc). } TypeMap_t; @@ -60,7 +60,7 @@ static TypeMap_t TypeMap[] = }; -char *GDinputvariable::m_pszEmpty = ""; +const char *GDinputvariable::m_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/fgdlib/inputoutput.cpp b/src/fgdlib/inputoutput.cpp index ea810c1345b..b514d5a059b 100644 --- a/src/fgdlib/inputoutput.cpp +++ b/src/fgdlib/inputoutput.cpp @@ -15,11 +15,11 @@ typedef struct { InputOutputType_t eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. } TypeMap_t; -char *CClassInputOutputBase::g_pszEmpty = ""; +const char *CClassInputOutputBase::g_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/fgdlib/wckeyvalues.cpp b/src/fgdlib/wckeyvalues.cpp index 83e52007c12..3998a6b9ec8 100644 --- a/src/fgdlib/wckeyvalues.cpp +++ b/src/fgdlib/wckeyvalues.cpp @@ -139,8 +139,8 @@ WCKeyValuesT::~WCKeyValuesT(void) template const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const { - int i = FindByKeyName( pszKey ); - if ( i == GetInvalidIndex() ) + int i = Base::FindByKeyName( pszKey ); + if ( i == Base::GetInvalidIndex() ) { return NULL; } @@ -149,7 +149,7 @@ const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const if(piIndex) piIndex[0] = i; - return m_KeyValues[i].szValue; + return Base::m_KeyValues[i].szValue; } } @@ -233,8 +233,8 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) StripEdgeWhiteSpace(szTmpKey); StripEdgeWhiteSpace(szTmpValue); - int i = FindByKeyName( szTmpKey ); - if ( i == GetInvalidIndex() ) + int i = Base::FindByKeyName( szTmpKey ); + if ( i == Base::GetInvalidIndex() ) { if ( pszValue ) { @@ -244,21 +244,21 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) MDkeyvalue newkv; Q_strncpy( newkv.szKey, szTmpKey, sizeof( newkv.szKey ) ); Q_strncpy( newkv.szValue, szTmpValue, sizeof( newkv.szValue ) ); - InsertKeyValue( newkv ); + Base::InsertKeyValue( newkv ); } } else { if (pszValue != NULL) { - V_strncpy(m_KeyValues[i].szValue, szTmpValue, sizeof(m_KeyValues[i].szValue)); + V_strncpy(Base::m_KeyValues[i].szValue, szTmpValue, sizeof(Base::m_KeyValues[i].szValue)); } // // If we are setting to a NULL value, delete the key. // else { - RemoveKeyAt( i ); + Base::RemoveKeyAt( i ); } } } @@ -270,7 +270,7 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) template void WCKeyValuesT::RemoveAll(void) { - m_KeyValues.RemoveAll(); + Base::m_KeyValues.RemoveAll(); } diff --git a/src/game/client/c_baselesson.cpp b/src/game/client/c_baselesson.cpp index 5c308a47fb1..647783ca109 100644 --- a/src/game/client/c_baselesson.cpp +++ b/src/game/client/c_baselesson.cpp @@ -1828,7 +1828,7 @@ void CScriptedIconLesson::InitElementsFromKeys( CUtlVector< LessonElement_t > *p pchToken = strtok( szSubKeyName, " " ); _fieldtypes paramType = LessonParamTypeFromString( pchToken ); - char *pchParam = ""; + const char *pchParam = ""; if ( paramType != FIELD_VOID ) { diff --git a/src/game/client/c_effects.h b/src/game/client/c_effects.h index 5f7e02a58fb..a29faf5a675 100644 --- a/src/game/client/c_effects.h +++ b/src/game/client/c_effects.h @@ -174,9 +174,9 @@ friend class CClient_Precipitation::CPrecipitationEffect; protected: float m_flParticleInnerDist; //The distance at which to start drawing the inner system - char *m_pParticleInnerNearDef; //Name of the first inner system - char *m_pParticleInnerFarDef; //Name of the second inner system - char *m_pParticleOuterDef; //Name of the outer system + const char *m_pParticleInnerNearDef; //Name of the first inner system + const char *m_pParticleInnerFarDef; //Name of the second inner system + const char *m_pParticleOuterDef; //Name of the outer system HPARTICLEFFECT m_pParticlePrecipInnerNear; HPARTICLEFFECT m_pParticlePrecipInnerFar; HPARTICLEFFECT m_pParticlePrecipOuter; diff --git a/src/game/client/c_team.cpp b/src/game/client/c_team.cpp index 5b5b36318c2..0023d694779 100644 --- a/src/game/client/c_team.cpp +++ b/src/game/client/c_team.cpp @@ -117,7 +117,7 @@ int C_Team::GetTeamNumber() const //================================================================================================= // Purpose: //----------------------------------------------------------------------------- -char *C_Team::Get_Name( void ) +const char *C_Team::Get_Name( void ) { return m_szTeamname; } diff --git a/src/game/client/c_team.h b/src/game/client/c_team.h index 5f26917b5b4..23dfb47299b 100644 --- a/src/game/client/c_team.h +++ b/src/game/client/c_team.h @@ -31,7 +31,7 @@ class C_Team : public C_BaseEntity virtual void PreDataUpdate( DataUpdateType_t updateType ); // Data Handling - virtual char *Get_Name( void ); + virtual const char *Get_Name( void ); virtual int Get_Score( void ); virtual int Get_Deaths( void ); virtual int Get_Ping( void ); diff --git a/src/game/client/econ/store/store_viewcart.cpp b/src/game/client/econ/store/store_viewcart.cpp index 718cc1d0e1a..144ce05e5ea 100644 --- a/src/game/client/econ/store/store_viewcart.cpp +++ b/src/game/client/econ/store/store_viewcart.cpp @@ -383,7 +383,7 @@ void CCartViewItemEntry::SetEntry( cart_item_t *pEntry, int iEntryIndex ) pRemoveButton->AddActionSignalTarget( GetStoreViewCartPanel() ); } - wchar_t *pwzPreviewItem = L""; + const wchar_t *pwzPreviewItem = L""; if ( pEntry->bPreviewItem ) { pwzPreviewItem = g_pVGuiLocalize->Find( "#Econ_Store_PurchaseType_PreviewItem" ); diff --git a/src/game/client/hl2mp/c_hl2mp_playerresource.cpp b/src/game/client/hl2mp/c_hl2mp_playerresource.cpp index a85dbb5f11b..c0bf4d31dcc 100644 --- a/src/game/client/hl2mp/c_hl2mp_playerresource.cpp +++ b/src/game/client/hl2mp/c_hl2mp_playerresource.cpp @@ -92,7 +92,7 @@ const char *C_HL2MP_PlayerResource::GetPlayerName( int index ) { if (FStrEq( m_szName[nBotIdx], PLAYER_UNCONNECTED_NAME )) { - wchar_t *pIdleLabel = g_pVGuiLocalize->Find( "#game_idle" ); + const wchar_t *pIdleLabel = g_pVGuiLocalize->Find( "#game_idle" ); if (!pIdleLabel) pIdleLabel = L"IDLE"; diff --git a/src/game/client/hud_squadstatus.cpp b/src/game/client/hud_squadstatus.cpp index 3abcd0c79c7..9a83d6bf3f7 100644 --- a/src/game/client/hud_squadstatus.cpp +++ b/src/game/client/hud_squadstatus.cpp @@ -244,7 +244,7 @@ void CHudSquadStatus::Paint() } // draw our squad status - wchar_t *text = NULL; + const wchar_t *text = NULL; if (m_bSquadMembersFollowing) { text = g_pVGuiLocalize->Find("#Valve_Hud_SQUAD_FOLLOWING"); diff --git a/src/game/client/tf/c_tf_team.cpp b/src/game/client/tf/c_tf_team.cpp index f3cfbc0723c..19becaea3ac 100644 --- a/src/game/client/tf/c_tf_team.cpp +++ b/src/game/client/tf/c_tf_team.cpp @@ -87,7 +87,7 @@ void C_TFTeam::OnDataChanged( DataUpdateType_t updateType ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char* C_TFTeam::Get_Name( void ) +const char* C_TFTeam::Get_Name( void ) { // Use Get_Localized_Name() instead AssertMsg( false, "Use Get_Localized_Name() instead" ); @@ -120,7 +120,7 @@ void C_TFTeam::UpdateTeamName( void ) if ( g_TF_PR && ( g_TF_PR->HasPremadeParties() || g_TF_PR->GetEventTeamStatus() ) ) { wchar_t wszTempName[MAX_TEAM_NAME_LENGTH]; - wchar_t *pFormat = g_pVGuiLocalize->Find( "#TF_Team_PartyLeader" ); + const wchar_t *pFormat = g_pVGuiLocalize->Find( "#TF_Team_PartyLeader" ); if ( !pFormat ) { pFormat = L"%s"; diff --git a/src/game/client/tf/c_tf_team.h b/src/game/client/tf/c_tf_team.h index 75c2d6365d3..f1f091fbf77 100644 --- a/src/game/client/tf/c_tf_team.h +++ b/src/game/client/tf/c_tf_team.h @@ -35,7 +35,7 @@ class C_TFTeam : public C_Team int GetFlagCaptures( void ) { return m_nFlagCaptures; } int GetRole( void ) { return m_iRole; } - char *Get_Name( void ); + const char *Get_Name( void ); int GetNumObjects( int iObjectType = -1 ); CBaseObject *GetObject( int num ); diff --git a/src/game/client/tf/c_tf_weapon_builder.cpp b/src/game/client/tf/c_tf_weapon_builder.cpp index cc8351307ed..3eee9f14601 100644 --- a/src/game/client/tf/c_tf_weapon_builder.cpp +++ b/src/game/client/tf/c_tf_weapon_builder.cpp @@ -262,7 +262,7 @@ void C_TFWeaponBuilder::SetupObjectSelectionSprite( void ) { #ifdef CLIENT_DLL // Use the sprite details from the text file, with a custom sprite - char *iconTexture = GetObjectInfo( m_iObjectType )->m_pIconActive; + const char *iconTexture = GetObjectInfo( m_iObjectType )->m_pIconActive; if ( iconTexture && iconTexture[ 0 ] ) { m_pSelectionTextureActive = gHUD.GetIcon( iconTexture ); diff --git a/src/game/client/tf/tf_demo_support.cpp b/src/game/client/tf/tf_demo_support.cpp index 2820487d4c3..39c15a9a2f3 100644 --- a/src/game/client/tf/tf_demo_support.cpp +++ b/src/game/client/tf/tf_demo_support.cpp @@ -209,7 +209,7 @@ void CTFDemoSupport::Status( void ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CTFDemoSupport::Notify( char *pszMessage ) +void CTFDemoSupport::Notify( const char *pszMessage ) { if ( engine->IsPlayingDemo() ) return; diff --git a/src/game/client/tf/tf_demo_support.h b/src/game/client/tf/tf_demo_support.h index 3dc2ee0a61f..72f4cff6f65 100644 --- a/src/game/client/tf/tf_demo_support.h +++ b/src/game/client/tf/tf_demo_support.h @@ -50,7 +50,7 @@ class CTFDemoSupport : public CAutoGameSystemPerFrame, public CGameEventListener private: bool IsValidPath( const char *pszFolder ); void LogEvent( EDemoEventType eType, int nValue = 0, const char *pszValue = NULL ); - void Notify( char *pszMessage ); + void Notify( const char *pszMessage ); bool m_bRecording; char m_szFolder[24]; diff --git a/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp b/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp index c43ee87c721..c8fdc44d7fc 100644 --- a/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp +++ b/src/game/client/tf/tf_hud_mann_vs_machine_status.cpp @@ -1390,7 +1390,7 @@ void CWaveCompleteSummaryPanel::OnTick( void ) //----------------------------------------------------------------------------- // Purpose: updates the target field based on the input args. Returns TRUE if transitioning to new state //----------------------------------------------------------------------------- -bool CWaveCompleteSummaryPanel::StateUpdateValue( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int endValue ) +bool CWaveCompleteSummaryPanel::StateUpdateValue( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int endValue ) { float fPercent = currentTime / targetTime; fPercent = 1.0 < fPercent ? 1.0f : fPercent; diff --git a/src/game/client/tf/tf_hud_mann_vs_machine_status.h b/src/game/client/tf/tf_hud_mann_vs_machine_status.h index da26709169e..08ca04323f5 100644 --- a/src/game/client/tf/tf_hud_mann_vs_machine_status.h +++ b/src/game/client/tf/tf_hud_mann_vs_machine_status.h @@ -244,7 +244,7 @@ class CWaveCompleteSummaryPanel : public vgui::EditablePanel FINISHED, }; - bool StateUpdateValue( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int endValue ); + bool StateUpdateValue( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int endValue ); void RatingLabelUpdate( void ); void RatingScoreUpdate( void ); diff --git a/src/game/client/tf/tf_hud_mann_vs_machine_victory.cpp b/src/game/client/tf/tf_hud_mann_vs_machine_victory.cpp index 699bba5e2e8..8f7933ed65a 100644 --- a/src/game/client/tf/tf_hud_mann_vs_machine_victory.cpp +++ b/src/game/client/tf/tf_hud_mann_vs_machine_victory.cpp @@ -295,7 +295,7 @@ void CVictoryPanel::CaptureStats() //----------------------------------------------------------------------------- // Purpose: updates the target field based on the input args. Returns TRUE if transitioning to new state //----------------------------------------------------------------------------- -bool CVictoryPanel::StateUpdateValue( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int endValue ) +bool CVictoryPanel::StateUpdateValue( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int endValue ) { float fPercent = currentTime / targetTime; fPercent = 1.0 < fPercent ? 1.0f : fPercent; @@ -325,7 +325,7 @@ bool CVictoryPanel::StateUpdateValue( vgui::EditablePanel *parent, char* field, // Purpose: updates the target field based on the input args. Returns TRUE if transitioning to new state // Adds "Credit" count text //----------------------------------------------------------------------------- -bool CVictoryPanel::StateUpdateCreditText( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int useValue, int creditValue ) +bool CVictoryPanel::StateUpdateCreditText( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int useValue, int creditValue ) { float fPercent = currentTime / targetTime; fPercent = 1.0 < fPercent ? 1.0f : fPercent; diff --git a/src/game/client/tf/tf_hud_mann_vs_machine_victory.h b/src/game/client/tf/tf_hud_mann_vs_machine_victory.h index 54be5f48f58..ba5e09dc547 100644 --- a/src/game/client/tf/tf_hud_mann_vs_machine_victory.h +++ b/src/game/client/tf/tf_hud_mann_vs_machine_victory.h @@ -66,8 +66,8 @@ class CVictoryPanel : public vgui::EditablePanel void CaptureStats(); - bool StateUpdateValue( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int endValue ); - bool StateUpdateCreditText( vgui::EditablePanel *parent, char* field, float targetTime, float currentTime, int nextState, int useValue, int creditValue ); + bool StateUpdateValue( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int endValue ); + bool StateUpdateCreditText( vgui::EditablePanel *parent, const char* field, float targetTime, float currentTime, int nextState, int useValue, int creditValue ); bool CheckState( float targetTime, float currentTime, int nextState ); void RatingLabelUpdate( void ); diff --git a/src/game/client/tf/tf_hud_passtime.cpp b/src/game/client/tf/tf_hud_passtime.cpp index 14c35389be9..0e76937a845 100644 --- a/src/game/client/tf/tf_hud_passtime.cpp +++ b/src/game/client/tf/tf_hud_passtime.cpp @@ -1578,7 +1578,7 @@ void CTFHudPasstimeBallStatus::OnBallGetOther( int iPlayer ) wchar_t wszFinalText[128]; wchar_t wszPlayerName[MAX_PLAYER_NAME_LENGTH]; - wchar_t *pwszFormatString = g_pVGuiLocalize->Find( "#TF_Passtime_CarrierName" ); + const wchar_t *pwszFormatString = g_pVGuiLocalize->Find( "#TF_Passtime_CarrierName" ); if ( !pwszFormatString ) { pwszFormatString = L"%s1"; @@ -1601,7 +1601,7 @@ void CTFHudPasstimeBallStatus::OnBallGetSelf( int iPlayer ) wchar_t wszFinalText[128]; wchar_t wszPlayerName[MAX_PLAYER_NAME_LENGTH]; - wchar_t *pwszFormatString = g_pVGuiLocalize->Find( "#TF_Passtime_CarrierName" ); + const wchar_t *pwszFormatString = g_pVGuiLocalize->Find( "#TF_Passtime_CarrierName" ); if ( !pwszFormatString ) { pwszFormatString = L"%s1"; diff --git a/src/game/client/tf/tf_hud_pve_winpanel.cpp b/src/game/client/tf/tf_hud_pve_winpanel.cpp index a8ab8efc662..98988623cee 100644 --- a/src/game/client/tf/tf_hud_pve_winpanel.cpp +++ b/src/game/client/tf/tf_hud_pve_winpanel.cpp @@ -95,7 +95,7 @@ void CTFPVEWinPanel::FireGameEvent( IGameEvent * event ) SetDialogVariable( "WinReasonLabel", "" ); SetDialogVariable( "DetailsLabel", "" ); - wchar_t *pwchWinReason = L""; + const wchar_t *pwchWinReason = L""; switch ( iWinReason ) { case 0: diff --git a/src/game/client/tf/vgui/crafting_panel.cpp b/src/game/client/tf/vgui/crafting_panel.cpp index 71372435ca4..4d208af6079 100644 --- a/src/game/client/tf/vgui/crafting_panel.cpp +++ b/src/game/client/tf/vgui/crafting_panel.cpp @@ -59,7 +59,7 @@ recipefilter_data_t g_RecipeFilters[NUM_RECIPE_CATEGORIES] = //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -wchar_t *LocalizeRecipeStringPiece( const char *pszString, wchar_t *pszConverted, int nConvertedSizeInBytes ) +const wchar_t *LocalizeRecipeStringPiece( const char *pszString, wchar_t *pszConverted, int nConvertedSizeInBytes ) { if ( !pszString ) return L""; @@ -104,16 +104,16 @@ void SetItemPanelToRecipe( CItemModelPanel *pPanel, const CEconCraftingRecipeDef wchar_t wcTmp[512]; // Build the input string - wchar_t *pInp_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_A(), wcTmpA, sizeof( wcTmpA ) ); - wchar_t *pInp_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_B(), wcTmpB, sizeof( wcTmpB ) ); - wchar_t *pInp_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_C(), wcTmpC, sizeof( wcTmpC ) ); + const wchar_t *pInp_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_A(), wcTmpA, sizeof( wcTmpA ) ); + const wchar_t *pInp_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_B(), wcTmpB, sizeof( wcTmpB ) ); + const wchar_t *pInp_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_C(), wcTmpC, sizeof( wcTmpC ) ); g_pVGuiLocalize->ConstructString_safe( wcTmpDesc, g_pVGuiLocalize->Find( pRecipeDef->GetDescInputs() ), 3, pInp_A, pInp_B, pInp_C ); iNegAttribsBegin = Q_wcslen(wcTmpDesc); // Build the output string - wchar_t *pOut_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_A(), wcTmpA, sizeof( wcTmpA ) ); - wchar_t *pOut_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_B(), wcTmpB, sizeof( wcTmpB ) ); - wchar_t *pOut_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_C(), wcTmpC, sizeof( wcTmpC ) ); + const wchar_t *pOut_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_A(), wcTmpA, sizeof( wcTmpA ) ); + const wchar_t *pOut_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_B(), wcTmpB, sizeof( wcTmpB ) ); + const wchar_t *pOut_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_C(), wcTmpC, sizeof( wcTmpC ) ); g_pVGuiLocalize->ConstructString_safe( wcTmp, g_pVGuiLocalize->Find( pRecipeDef->GetDescOutputs() ), 3, pOut_A, pOut_B, pOut_C ); // Concatenate, and mark the text changes @@ -654,15 +654,15 @@ void CCraftingPanel::UpdateRecipeItems( bool bClearInputItems ) wchar_t wcTmpB[32]; wchar_t wcTmpC[32]; wchar_t wcTmp[512]; - wchar_t *pOut_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_A(), wcTmpA, sizeof( wcTmpA ) ); - wchar_t *pOut_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_B(), wcTmpB, sizeof( wcTmpB ) ); + const wchar_t *pOut_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_A(), wcTmpA, sizeof( wcTmpA ) ); + const wchar_t *pOut_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_B(), wcTmpB, sizeof( wcTmpB ) ); wcTmp[0] = '\0'; V_wcscat_safe( wcTmp, pOut_A ); V_wcscat_safe( wcTmp, L" " ); V_wcscat_safe( wcTmp, pOut_B ); if ( Q_strnicmp( pRecipeDef->GetDescOutputs(), "#RDO_ABC", 8 ) == 0 ) { - wchar_t *pOut_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_C(), wcTmpC, sizeof( wcTmpC ) ); + const wchar_t *pOut_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescO_C(), wcTmpC, sizeof( wcTmpC ) ); V_wcscat_safe( wcTmp, L" " ); V_wcscat_safe( wcTmp, pOut_C ); } @@ -921,9 +921,9 @@ void CCraftingPanel::UpdateSelectedRecipe( bool bClearInputItems ) wchar_t wcTmpB[32]; wchar_t wcTmpC[32]; wchar_t wcTmpDesc[512]; - wchar_t *pInp_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_A(), wcTmpA, sizeof( wcTmpA ) ); - wchar_t *pInp_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_B(), wcTmpB, sizeof( wcTmpB ) ); - wchar_t *pInp_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_C(), wcTmpC, sizeof( wcTmpC ) ); + const wchar_t *pInp_A = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_A(), wcTmpA, sizeof( wcTmpA ) ); + const wchar_t *pInp_B = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_B(), wcTmpB, sizeof( wcTmpB ) ); + const wchar_t *pInp_C = LocalizeRecipeStringPiece( pRecipeDef->GetDescI_C(), wcTmpC, sizeof( wcTmpC ) ); g_pVGuiLocalize->ConstructString_safe( wcTmpDesc, g_pVGuiLocalize->Find( pRecipeDef->GetDescInputs() ), 3, pInp_A, pInp_B, pInp_C ); m_pSelectedRecipeContainer->SetDialogVariable( "recipeinputstring", wcTmpDesc ); } diff --git a/src/game/client/tf/vgui/tf_matchmaking_dashboard_party_member.cpp b/src/game/client/tf/vgui/tf_matchmaking_dashboard_party_member.cpp index efcd5b0cbcc..2c810c725cd 100644 --- a/src/game/client/tf/vgui/tf_matchmaking_dashboard_party_member.cpp +++ b/src/game/client/tf/vgui/tf_matchmaking_dashboard_party_member.cpp @@ -113,9 +113,9 @@ void CDashboardPartyMember::ApplySettings( KeyValues *inResourceData ) m_nDisplayPartySlot = inResourceData->GetInt( "party_slot" ); } -wchar_t* FindStringSafe( const char* pszToken ) +const wchar_t* FindStringSafe( const char* pszToken ) { - static wchar_t* wszEmptyString = L""; + static const wchar_t* wszEmptyString = L""; auto index = g_pVGuiLocalize->FindIndex( pszToken ); if ( index == INVALID_LOCALIZE_STRING_INDEX ) return wszEmptyString; diff --git a/src/game/client/vguicenterprint.h b/src/game/client/vguicenterprint.h index 639debc684c..237c8011b64 100644 --- a/src/game/client/vguicenterprint.h +++ b/src/game/client/vguicenterprint.h @@ -40,6 +40,13 @@ class CCenterPrint : public ICenterPrint virtual void Print( wchar_t *text ); virtual void ColorPrint( int r, int g, int b, int a, char *text ); virtual void ColorPrint( int r, int g, int b, int a, wchar_t *text ); + + // Damn engine interface..... + virtual void Print( const char *text ) { Print( const_cast(text) ); } + virtual void Print( const wchar_t *text ) { Print( const_cast(text) ); } + virtual void ColorPrint( int r, int g, int b, int a, const char *text ) { ColorPrint( r, g, b, a, const_cast(text) ); } + virtual void ColorPrint( int r, int g, int b, int a, const wchar_t *text ) { ColorPrint( r, g, b, a, const_cast(text) ); } + virtual void Clear( void ); }; diff --git a/src/game/server/NextBot/NextBotBehavior.h b/src/game/server/NextBot/NextBotBehavior.h index 2f92a8411b9..31e37231418 100644 --- a/src/game/server/NextBot/NextBotBehavior.h +++ b/src/game/server/NextBot/NextBotBehavior.h @@ -662,7 +662,7 @@ class Action : public INextBotEventResponder, public IContextualQuery virtual EventDesiredResult< Actor > OnSight( Actor *me, CBaseEntity *subject ) { return TryContinue(); } virtual EventDesiredResult< Actor > OnLostSight( Actor *me, CBaseEntity *subject ) { return TryContinue(); } virtual EventDesiredResult< Actor > OnSound( Actor *me, CBaseEntity *source, const Vector &pos, KeyValues *keys ) { return TryContinue(); } - virtual EventDesiredResult< Actor > OnSpokeConcept( Actor *me, CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ) { return TryContinue(); } + virtual EventDesiredResult< Actor > OnSpokeConcept( Actor *me, CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ) { return TryContinue(); } virtual EventDesiredResult< Actor > OnWeaponFired( Actor *me, CBaseCombatCharacter *whoFired, CBaseCombatWeapon *weapon ) { return TryContinue(); } virtual EventDesiredResult< Actor > OnNavAreaChanged( Actor *me, CNavArea *newArea, CNavArea *oldArea ) { return TryContinue(); } virtual EventDesiredResult< Actor > OnModelChanged( Actor *me ) { return TryContinue(); } @@ -913,7 +913,7 @@ class Action : public INextBotEventResponder, public IContextualQuery virtual void OnSight( CBaseEntity *subject ) { PROCESS_EVENT_WITH_1_ARG( OnSight, subject ); } virtual void OnLostSight( CBaseEntity *subject ) { PROCESS_EVENT_WITH_1_ARG( OnLostSight, subject ); } virtual void OnSound( CBaseEntity *source, const Vector &pos, KeyValues *keys ) { PROCESS_EVENT_WITH_3_ARGS( OnSound, source, pos, keys ); } - virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ) { PROCESS_EVENT_WITH_3_ARGS( OnSpokeConcept, who, concept, response ); } + virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ) { PROCESS_EVENT_WITH_3_ARGS( OnSpokeConcept, who, aiconcept, response ); } virtual void OnWeaponFired( CBaseCombatCharacter *whoFired, CBaseCombatWeapon *weapon ) { PROCESS_EVENT_WITH_2_ARGS( OnWeaponFired, whoFired, weapon ); } virtual void OnNavAreaChanged( CNavArea *newArea, CNavArea *oldArea ) { PROCESS_EVENT_WITH_2_ARGS( OnNavAreaChanged, newArea, oldArea ); } virtual void OnModelChanged( void ) { PROCESS_EVENT( OnModelChanged ); } diff --git a/src/game/server/NextBot/NextBotEventResponderInterface.h b/src/game/server/NextBot/NextBotEventResponderInterface.h index 9e7ba56843c..36890d4d87b 100644 --- a/src/game/server/NextBot/NextBotEventResponderInterface.h +++ b/src/game/server/NextBot/NextBotEventResponderInterface.h @@ -72,7 +72,7 @@ class INextBotEventResponder virtual void OnLostSight( CBaseEntity *subject ); // when subject leaves enters bot's visual awareness virtual void OnSound( CBaseEntity *source, const Vector &pos, KeyValues *keys ); // when an entity emits a sound. "pos" is world coordinates of sound. "keys" are from sound's GameData - virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ); // when an Actor speaks a concept + virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ); // when an Actor speaks a concept virtual void OnWeaponFired( CBaseCombatCharacter *whoFired, CBaseCombatWeapon *weapon ); // when someone fires a weapon virtual void OnNavAreaChanged( CNavArea *newArea, CNavArea *oldArea ); // when bot enters a new navigation area @@ -265,11 +265,11 @@ inline void INextBotEventResponder::OnSound( CBaseEntity *source, const Vector & } } -inline void INextBotEventResponder::OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ) +inline void INextBotEventResponder::OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ) { for ( INextBotEventResponder *sub = FirstContainedResponder(); sub; sub = NextContainedResponder( sub ) ) { - sub->OnSpokeConcept( who, concept, response ); + sub->OnSpokeConcept( who, aiconcept, response ); } } diff --git a/src/game/server/NextBot/NextBotManager.cpp b/src/game/server/NextBot/NextBotManager.cpp index 2ce9c6c800c..7e09e020127 100644 --- a/src/game/server/NextBot/NextBotManager.cpp +++ b/src/game/server/NextBot/NextBotManager.cpp @@ -614,7 +614,7 @@ void NextBotManager::OnSound( CBaseEntity *source, const Vector &pos, KeyValues class NextBotResponseNotifyScan { public: - NextBotResponseNotifyScan( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ) : m_who( who ), m_concept( concept ), m_response( response ) + NextBotResponseNotifyScan( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ) : m_who( who ), m_concept( aiconcept ), m_response( response ) { } @@ -637,17 +637,17 @@ class NextBotResponseNotifyScan /** * When an Actor speaks a concept */ -void NextBotManager::OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ) +void NextBotManager::OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ) { - NextBotResponseNotifyScan notify( who, concept, response ); + NextBotResponseNotifyScan notify( who, aiconcept, response ); TheNextBots().ForEachBot( notify ); if ( IsDebugging( NEXTBOT_HEARING ) ) { // const char *who = response->GetCriteria()->GetValue( response->GetCriteria()->FindCriterionIndex( "Who" ) ); - // TODO: Need concept.GetStringConcept() - DevMsg( "%3.2f: OnSpokeConcept( %s, %s )\n", gpGlobals->curtime, who->GetDebugName(), "concept.GetStringConcept()" ); + // TODO: Need aiconcept.GetStringConcept() + DevMsg( "%3.2f: OnSpokeConcept( %s, %s )\n", gpGlobals->curtime, who->GetDebugName(), "aiconcept.GetStringConcept()" ); } } diff --git a/src/game/server/NextBot/NextBotManager.h b/src/game/server/NextBot/NextBotManager.h index 197b2ad790f..3240bc0986f 100644 --- a/src/game/server/NextBot/NextBotManager.h +++ b/src/game/server/NextBot/NextBotManager.h @@ -107,7 +107,7 @@ class NextBotManager virtual void OnBeginChangeLevel( void ); // when the server is about to change maps virtual void OnKilled( CBaseCombatCharacter *victim, const CTakeDamageInfo &info ); // when an actor is killed virtual void OnSound( CBaseEntity *source, const Vector &pos, KeyValues *keys ); // when an entity emits a sound - virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t concept, AI_Response *response ); // when an Actor speaks a concept + virtual void OnSpokeConcept( CBaseCombatCharacter *who, AIConcept_t aiconcept, AI_Response *response ); // when an Actor speaks a concept virtual void OnWeaponFired( CBaseCombatCharacter *whoFired, CBaseCombatWeapon *weapon ); // when someone fires a weapon /** diff --git a/src/game/server/ai_basenpc.cpp b/src/game/server/ai_basenpc.cpp index 2a2779f272f..83a82ba138d 100644 --- a/src/game/server/ai_basenpc.cpp +++ b/src/game/server/ai_basenpc.cpp @@ -15372,7 +15372,7 @@ void CAI_BaseNPC::ParseScriptedNPCInteractions(void) sInteraction.flDistSqr = (DSS_MAX_DIST * DSS_MAX_DIST); // Misc. response criteria - char* szCriteria = ""; + const char* szCriteria = ""; KeyValues* pCurNode = pkvNode->GetFirstSubKey(); const char* szName = NULL; diff --git a/src/game/server/ai_behavior_lead.cpp b/src/game/server/ai_behavior_lead.cpp index ce5589b2c32..084cfdf5a75 100644 --- a/src/game/server/ai_behavior_lead.cpp +++ b/src/game/server/ai_behavior_lead.cpp @@ -1037,7 +1037,7 @@ void CAI_LeadBehavior::RunTask( const Task_t *pTask ) //------------------------------------- -bool CAI_LeadBehavior::Speak( AIConcept_t concept ) +bool CAI_LeadBehavior::Speak( AIConcept_t aiconcept ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( !pExpresser ) @@ -1048,7 +1048,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) return false; // If we haven't said the start speech, don't nag - bool bNag = ( FStrEq(concept,TLK_LEAD_COMINGBACK) || FStrEq(concept, TLK_LEAD_CATCHUP) || FStrEq(concept, TLK_LEAD_RETRIEVE) ); + bool bNag = ( FStrEq(aiconcept,TLK_LEAD_COMINGBACK) || FStrEq(aiconcept, TLK_LEAD_CATCHUP) || FStrEq(aiconcept, TLK_LEAD_RETRIEVE) ); if ( !m_hasspokenstart && bNag ) return false; @@ -1059,7 +1059,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) // We ignore nag timers for this, because the response rules will control refire rates. CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly ) - return pAlly->SpeakIfAllowed( concept, GetConceptModifiers( concept ) ); + return pAlly->SpeakIfAllowed( aiconcept, GetConceptModifiers( aiconcept ) ); } // Don't spam Nags @@ -1072,7 +1072,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) } } - if ( pExpresser->Speak( concept, GetConceptModifiers( concept ) ) ) + if ( pExpresser->Speak( aiconcept, GetConceptModifiers( aiconcept ) ) ) { m_flSpeakNextNagTime = gpGlobals->curtime + LEAD_NAG_TIME; return true; diff --git a/src/game/server/ai_behavior_lead.h b/src/game/server/ai_behavior_lead.h index ef4bb0253ac..d3d2091a890 100644 --- a/src/game/server/ai_behavior_lead.h +++ b/src/game/server/ai_behavior_lead.h @@ -195,7 +195,7 @@ class CAI_LeadBehavior : public CAI_SimpleBehavior bool GetClosestPointOnRoute( const Vector &targetPos, Vector *pVecClosestPoint ); bool PlayerIsAheadOfMe( bool bForce = false ); - bool Speak( AIConcept_t concept ); + bool Speak( AIConcept_t aiconcept ); bool IsSpeaking(); // -------------------------------- diff --git a/src/game/server/ai_behavior_passenger.cpp b/src/game/server/ai_behavior_passenger.cpp index d5d4439d1b4..ee3eb528583 100644 --- a/src/game/server/ai_behavior_passenger.cpp +++ b/src/game/server/ai_behavior_passenger.cpp @@ -1554,12 +1554,12 @@ void CAI_PassengerBehavior::SetTransitionSequence( int nSequence ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t concept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) +bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) { // FIXME: Store this cast off? CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly != NULL ) - return pAlly->SpeakIfAllowed( concept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); + return pAlly->SpeakIfAllowed( aiconcept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); return false; } diff --git a/src/game/server/ai_behavior_passenger.h b/src/game/server/ai_behavior_passenger.h index 61e0d730272..dd9ef16d47e 100644 --- a/src/game/server/ai_behavior_passenger.h +++ b/src/game/server/ai_behavior_passenger.h @@ -149,7 +149,7 @@ class CAI_PassengerBehavior : public CAI_SimpleBehavior virtual int SelectTransitionSchedule( void ); - bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + bool SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); bool CanExitVehicle( void ); void SetTransitionSequence( int nSequence ); diff --git a/src/game/server/ai_concommands.cpp b/src/game/server/ai_concommands.cpp index 6c4370d934e..3e228a48b61 100644 --- a/src/game/server/ai_concommands.cpp +++ b/src/game/server/ai_concommands.cpp @@ -392,7 +392,7 @@ static ConCommand npc_focus("npc_focus", CC_NPC_Focus, "Displays red line to NPC ConVar npc_create_equipment("npc_create_equipment", ""); #ifdef MAPBASE -extern int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, char *substring, int checklen = 0 ); +extern int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, const char *substring, int checklen = 0 ); extern bool UtlStringLessFunc( const CUtlString &lhs, const CUtlString &rhs ); //------------------------------------------------------------------------------ @@ -517,10 +517,10 @@ class CNPCCreateAutoCompletionFunctor : public ICommandCallback, public ICommand const char *cmdname = CreateAimed() ? "npc_create_aimed" : "npc_create"; - char *substring = (char *)partial; + const char *substring = partial; if ( Q_strstr( partial, cmdname ) ) { - substring = (char *)partial + strlen( cmdname ) + 1; + substring = partial + strlen( cmdname ) + 1; } int checklen = Q_strlen( substring ); diff --git a/src/game/server/ai_expresserfollowup.cpp b/src/game/server/ai_expresserfollowup.cpp index cba7c26bf46..8219acfefdc 100644 --- a/src/game/server/ai_expresserfollowup.cpp +++ b/src/game/server/ai_expresserfollowup.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -118,9 +118,9 @@ static void DispatchComeback( CAI_ExpresserWithFollowup *pExpress, CBaseEntity * // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &aiconcept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - AI_Response *result = SpeakFindResponse( concept, modifiers ); + AI_Response *result = SpeakFindResponse( aiconcept, modifiers ); if ( !result ) { return false; @@ -176,14 +176,14 @@ static CBaseEntity *AscertainSpeechSubjectFromContext( AI_Response *response, AI } // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &aiconcept, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) { if ( Q_stricmp(szTarget, "self") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, aiconcept.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "subject") == 0 ) { @@ -200,7 +200,7 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo } else if ( Q_stricmp(szTarget, "any") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, aiconcept.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "all") == 0 ) { @@ -209,7 +209,7 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo // last resort, try a named lookup #ifdef MAPBASE - else if ( CBaseEntity *pSpecific = gEntList.FindEntityByName(NULL, szTarget, concept.GetSpeaker()) ) // it could be anything + else if ( CBaseEntity *pSpecific = gEntList.FindEntityByName(NULL, szTarget, aiconcept.GetSpeaker()) ) // it could be anything #else else if ( CBaseEntity *pSpecific = gEntList.FindEntityByName(NULL, szTarget) ) // it could be anything #endif @@ -223,20 +223,20 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &aiconcept, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) { const char * RESTRICT szTarget = followup->followup_target; const CResponseQueue::CFollowupTargetSpec_t INVALID; // default: invalid result if ( szTarget == NULL ) return INVALID; else - return ResolveFollowupTargetToEntity( concept, criteria, szTarget, response ); + return ResolveFollowupTargetToEntity( aiconcept, criteria, szTarget, response ); } ConVar chet_debug_idle( "chet_debug_idle", "0", FCVAR_ARCHIVE, "If set one, many debug prints to help track down the TLK_IDLE issue. Set two for super verbose info" ); // extern ConVar chet_debug_idle; -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -244,12 +244,12 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t concept, const char *modifier return false; } - concept.SetSpeaker(GetOuter()); + aiconcept.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, aiconcept, modifiers); GetOuter()->ModifyOrAppendDerivedCriteria(criteria); AI_Response result; - if ( !FindResponse( result, concept, &criteria ) ) + if ( !FindResponse( result, aiconcept, &criteria ) ) { if (chet_debug_idle.GetBool()) { @@ -272,10 +272,10 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t concept, const char *modifier } } - SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); - // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); + SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)aiconcept, gpGlobals->curtime ); + // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), aiconcept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, &criteria, filter ); + bool spoke = SpeakDispatchResponse( aiconcept, &result, &criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -308,16 +308,16 @@ static float GetSpeechDurationForResponse( const AI_Response * RESTRICT response // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) +bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) { // This gives the chance for the other bot to respond. - if ( !concept.GetSpeaker().IsValid() ) + if ( !aiconcept.GetSpeaker().IsValid() ) { - concept.SetSpeaker(GetOuter()); + aiconcept.SetSpeaker(GetOuter()); } bool bInterrupted = IsSpeaking(); - bool bSuc = CAI_Expresser::SpeakDispatchResponse( concept, response, criteria, filter ); + bool bSuc = CAI_Expresser::SpeakDispatchResponse( aiconcept, response, criteria, filter ); if (!bSuc) { return false; @@ -335,7 +335,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R if ( followup->followup_entityiotarget && followup->followup_entityioinput ) { #ifdef MAPBASE - CBaseEntity * RESTRICT pTarget = ResolveFollowupTargetToEntity( concept, *criteria, followup->followup_entityiotarget, response ).m_hHandle; + CBaseEntity * RESTRICT pTarget = ResolveFollowupTargetToEntity( aiconcept, *criteria, followup->followup_entityiotarget, response ).m_hHandle; #else CBaseEntity * RESTRICT pTarget = gEntList.FindEntityByName( NULL, followup->followup_entityiotarget ); #endif @@ -358,7 +358,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R if ( fTimeToLastSpeech > 0 ) { DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( aiconcept, *criteria, response, followup ), fTimeToLastSpeech + followup->followup_delay, GetOuter() ); } else // error @@ -366,11 +366,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R // old way, copied from "else" below m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( aiconcept, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( aiconcept, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -384,7 +384,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R // In this case we do not need to postpone the followup; we just throw it directly // into the queue. DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( aiconcept, *criteria, response, followup ), -followup->followup_delay, GetOuter() ); } #ifndef MAPBASE // RESPONSE_PRINT now notes speaking time @@ -392,7 +392,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R { // zero-duration responses dispatch immediately via the queue (must be the queue bec. // the m_pPostponedFollowup will never trigger) DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( aiconcept, *criteria, response, followup ), followup->followup_delay, GetOuter() ); } #endif @@ -403,11 +403,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R // 5.13.08 egr m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( aiconcept, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( aiconcept, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -421,7 +421,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_R // for "this many seconds after the beginning of the line" rather than "this may seconds after the end // of the line", eg to create a THEN rule when two characters talk over each other. // It's static to avoid accidental use of the postponed followup/target members. -void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &concept, +void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &aiconcept, const char * RESTRICT criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, @@ -445,7 +445,7 @@ void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t #endif criteria.Merge( criteriaStr ); - g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, target, pOuter ); + g_ResponseQueueManager.GetQueue()->Add( aiconcept, &criteria, gpGlobals->curtime + delay, target, pOuter ); } //----------------------------------------------------------------------------- @@ -507,8 +507,8 @@ void CC_RR_ForceConcept_f( const CCommand &args ) criteria.Merge( criteriastring ); } - AIConcept_t concept( args[2] ); - QueueSpeak( concept, ResolveFollowupTargetToEntity( concept, criteria, args[1] ), criteria ); + AIConcept_t aiconcept( args[2] ); + QueueSpeak( aiconcept, ResolveFollowupTargetToEntity( aiconcept, criteria, args[1] ), criteria ); } diff --git a/src/game/server/ai_playerally.cpp b/src/game/server/ai_playerally.cpp index 3e87637d178..67a2105a594 100644 --- a/src/game/server/ai_playerally.cpp +++ b/src/game/server/ai_playerally.cpp @@ -166,7 +166,7 @@ class CConceptInfoMap : public CUtlMap { { for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) { - Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] ); + Insert( g_ConceptInfos[i].aiconcept, &g_ConceptInfos[i] ); } } }; @@ -189,7 +189,7 @@ void CAI_AllySpeechManager::Spawn() { Assert( g_ConceptInfoMap.Count() != 0 ); for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) - m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].aiconcept ), CSimpleSimTimer() ); } void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) @@ -197,14 +197,14 @@ void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) Assert( g_ConceptInfoMap.Count() != 0 ); Assert( m_ConceptTimers.Count() != 0 ); - if ( g_ConceptInfoMap.Find( conceptInfo.concept ) == g_ConceptInfoMap.InvalidIndex() ) + if ( g_ConceptInfoMap.Find( conceptInfo.aiconcept ) == g_ConceptInfoMap.InvalidIndex() ) { - g_ConceptInfoMap.Insert( conceptInfo.concept, new ConceptInfo_t( conceptInfo ) ); + g_ConceptInfoMap.Insert( conceptInfo.aiconcept, new ConceptInfo_t( conceptInfo ) ); } - if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.concept) ) == m_ConceptTimers.InvalidIndex() ) + if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.aiconcept) ) == m_ConceptTimers.InvalidIndex() ) { - m_ConceptTimers.Insert( AllocPooledString( conceptInfo.concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( conceptInfo.aiconcept ), CSimpleSimTimer() ); } } @@ -213,16 +213,16 @@ ConceptCategoryInfo_t *CAI_AllySpeechManager::GetConceptCategoryInfo( ConceptCat return &g_ConceptCategoryInfos[category]; } -ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t concept ) +ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t aiconcept ) { - int iResult = g_ConceptInfoMap.Find( concept ); + int iResult = g_ConceptInfoMap.Find( aiconcept ); return ( iResult != g_ConceptInfoMap.InvalidIndex() ) ? g_ConceptInfoMap[iResult] : NULL; } -void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ) +void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t aiconcept, AI_Response *response ) { - ConceptInfo_t * pConceptInfo = GetConceptInfo( concept ); + ConceptInfo_t * pConceptInfo = GetConceptInfo( aiconcept ); ConceptCategory_t category = ( pConceptInfo ) ? pConceptInfo->category : SPEECH_IDLE; ConceptCategoryInfo_t * pCategoryInfo = GetConceptCategoryInfo( category ); @@ -241,7 +241,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce pPlayerAlly->FVisible( pTalker ) ) { // Tell this guy he's already said the concept to the player, too. - pTalker->GetExpresser()->SetSpokeConcept( concept, NULL, false ); + pTalker->GetExpresser()->SetSpokeConcept( aiconcept, NULL, false ); } } } @@ -272,7 +272,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce if ( pConceptInfo && pConceptInfo->minConceptDelay != -1 ) { Assert( pConceptInfo->maxConceptDelay != -1 ); - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(aiconcept) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) m_ConceptTimers[iConceptTimer].Set( pConceptInfo->minConceptDelay, pConceptInfo->minConceptDelay ); } @@ -292,9 +292,9 @@ bool CAI_AllySpeechManager::CategoryDelayExpired( ConceptCategory_t category ) return m_ConceptCategoryTimers[category].Expired(); } -bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t concept ) +bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t aiconcept ) { - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(aiconcept) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) return m_ConceptTimers[iConceptTimer].Expired(); return true; @@ -587,9 +587,9 @@ void CAI_PlayerAlly::PrescheduleThink( void ) { SetSpeechTarget( selection.hSpeechTarget ); #ifdef NEW_RESPONSE_SYSTEM - SpeakDispatchResponse( selection.concept.c_str(), &selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), &selection.Response ); #else - SpeakDispatchResponse( selection.concept.c_str(), selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), selection.Response ); #endif m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 ); } @@ -628,14 +628,14 @@ int CAI_PlayerAlly::SelectSchedule( void ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) +bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t aiconcept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) { - if ( IsAllowedToSpeak( concept ) ) + if ( IsAllowedToSpeak( aiconcept ) ) { - bool result = SpeakFindResponse( pSelection->Response, concept, pszModifiers ); + bool result = SpeakFindResponse( pSelection->Response, aiconcept, pszModifiers ); if ( result ) { - pSelection->concept = concept; + pSelection->aiconcept = aiconcept; pSelection->hSpeechTarget = pTarget; return true; } @@ -647,12 +647,12 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response &Response ) +void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t aiconcept, AI_Response &Response ) { m_PendingResponse = Response; #ifndef NEW_RESPONSE_SYSTEM #endif - m_PendingConcept = concept; + m_PendingConcept = aiconcept; m_TimePendingSet = gpGlobals->curtime; } @@ -734,9 +734,9 @@ bool CAI_PlayerAlly::SelectInterjection() { SetSpeechTarget( selection.hSpeechTarget ); #ifdef NEW_RESPONSE_SYSTEM - SpeakDispatchResponse( selection.concept.c_str(), &selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), &selection.Response ); #else - SpeakDispatchResponse( selection.concept.c_str(), selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), selection.Response ); #endif return true; } @@ -787,14 +787,14 @@ bool CAI_PlayerAlly::SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelect //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response ) { #ifdef HL2_EPISODIC CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( aiconcept ); if ( pConceptInfo && (pConceptInfo->flags & AICF_QUESTION) && GetSpeechTarget() ) { - bool bSaidHelloToNPC = !Q_strcmp(concept, "TLK_HELLO_NPC"); + bool bSaidHelloToNPC = !Q_strcmp(aiconcept, "TLK_HELLO_NPC"); float duration = GetExpresser()->GetSemaphoreAvailableTime(this) - gpGlobals->curtime; @@ -802,11 +802,11 @@ void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response { if ( bSaidHelloToNPC ) { - Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)concept ); + Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)aiconcept ); } else { - Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)concept ); + Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)aiconcept ); } NDebugOverlay::HorzArrow( GetAbsOrigin(), GetSpeechTarget()->GetAbsOrigin(), 8, 0, 255, 0, 64, true, duration ); } @@ -910,7 +910,7 @@ bool CAI_PlayerAlly::SelectAnswerFriend( CBaseEntity *pFriend, AISpeechSelection //----------------------------------------------------------------------------- // Purpose: Asks a question now. //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::AskQuestionNow( CBaseEntity *pSpeechTarget, int iQARandomNumber, const char *concept ) +bool CAI_PlayerAlly::AskQuestionNow( CBaseEntity *pSpeechTarget, int iQARandomNumber, const char *aiconcept ) { m_hPotentialSpeechTarget = pSpeechTarget; m_iQARandomNumber = iQARandomNumber; @@ -923,18 +923,18 @@ bool CAI_PlayerAlly::AskQuestionNow( CBaseEntity *pSpeechTarget, int iQARandomNu AISpeechSelection_t selection; #ifdef NEW_RESPONSE_SYSTEM - if (SelectSpeechResponse( concept, NULL, m_hPotentialSpeechTarget.Get(), &selection )) + if (SelectSpeechResponse( aiconcept, NULL, m_hPotentialSpeechTarget.Get(), &selection )) { SetSpeechTarget( selection.hSpeechTarget ); ClearPendingSpeech(); // Speak immediately - return SpeakDispatchResponse( selection.concept.c_str(), &selection.Response ); + return SpeakDispatchResponse( selection.aiconcept.c_str(), &selection.Response ); } return false; #else - SelectSpeechResponse( concept, NULL, m_hPotentialSpeechTarget.Get(), &selection ); + SelectSpeechResponse( aiconcept, NULL, m_hPotentialSpeechTarget.Get(), &selection ); SetSpeechTarget( selection.hSpeechTarget ); ClearPendingSpeech(); @@ -943,7 +943,7 @@ bool CAI_PlayerAlly::AskQuestionNow( CBaseEntity *pSpeechTarget, int iQARandomNu return false; // Speak immediately - return SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse ); + return SpeakDispatchResponse( selection.aiconcept.c_str(), selection.pResponse ); #endif } @@ -954,7 +954,7 @@ void CAI_PlayerAlly::InputAskQuestion( inputdata_t &inputdata ) { CBaseEntity *pSpeechTarget = NULL; int iQARandomNumber = 0; - const char *concept = TLK_QUESTION; + const char *aiconcept = TLK_QUESTION; // I didn't feel like using strtok today. CUtlStringList vecStrings; @@ -968,7 +968,7 @@ void CAI_PlayerAlly::InputAskQuestion( inputdata_t &inputdata ) { case 0: iQARandomNumber = atoi(vecStrings[i]); break; case 1: pSpeechTarget = gEntList.FindEntityByName(NULL, vecStrings[i], this, inputdata.pActivator, inputdata.pCaller); break; - case 2: concept = vecStrings[i]; break; + case 2: aiconcept = vecStrings[i]; break; } } @@ -983,7 +983,7 @@ void CAI_PlayerAlly::InputAskQuestion( inputdata_t &inputdata ) pSpeechTarget = NULL; } - AskQuestionNow(pSpeechTarget, iQARandomNumber, concept); + AskQuestionNow(pSpeechTarget, iQARandomNumber, aiconcept); } #endif @@ -1034,9 +1034,9 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN SetSpeechTarget( selection.hSpeechTarget ); #ifdef NEW_RESPONSE_SYSTEM - SpeakDispatchResponse( selection.concept.c_str(), &selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), &selection.Response ); #else - SpeakDispatchResponse( selection.concept.c_str(), selection.Response ); + SpeakDispatchResponse( selection.aiconcept.c_str(), selection.Response ); #endif // Prevent idle speech for a while @@ -1091,9 +1091,9 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule() SetSpeechTarget( selection.hSpeechTarget ); #ifdef NEW_RESPONSE_SYSTEM - SetPendingSpeech( selection.concept.c_str(), selection.Response ); + SetPendingSpeech( selection.aiconcept.c_str(), selection.Response ); #else - SetPendingSpeech( selection.concept.c_str(), &selection.Response ); + SetPendingSpeech( selection.aiconcept.c_str(), &selection.Response ); #endif } } @@ -1783,10 +1783,10 @@ bool CAI_PlayerAlly::IsOkToSpeakInResponseToPlayer( void ) //----------------------------------------------------------------------------- // Purpose: Return true if I should speak based on the chance & the speech filter's modifier //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) +bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t aiconcept, int iChance ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( aiconcept ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( GetSpeechFilter() ) @@ -1812,10 +1812,10 @@ bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer ) +bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t aiconcept, bool bRespondingToPlayer ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( aiconcept ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( !IsOkToSpeak( category, bRespondingToPlayer ) ) @@ -1823,19 +1823,19 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl if ( GetSpeechFilter() && GetSpeechFilter()->NeverSayHello() ) { - if ( CompareConcepts( concept, TLK_HELLO ) ) + if ( CompareConcepts( aiconcept, TLK_HELLO ) ) return false; - if ( CompareConcepts( concept, TLK_HELLO_NPC ) ) + if ( CompareConcepts( aiconcept, TLK_HELLO_NPC ) ) return false; } - if ( !pSpeechManager->ConceptDelayExpired( concept ) ) + if ( !pSpeechManager->ConceptDelayExpired( aiconcept ) ) return false; - if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( concept ) ) + if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( aiconcept ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( aiconcept ) ) return false; return true; @@ -1846,10 +1846,10 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl // Purpose: Specifically for player allies handling followup responses. // Better-accounts for unknown concepts so that users are free in what they use. //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::IsAllowedToSpeakFollowup( AIConcept_t concept, CBaseEntity *pIssuer, bool bSpecific ) +bool CAI_PlayerAlly::IsAllowedToSpeakFollowup( AIConcept_t aiconcept, CBaseEntity *pIssuer, bool bSpecific ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( aiconcept ); ConceptCategory_t category = SPEECH_PRIORITY; // Must be SPEECH_PRIORITY to get around semaphore if ( !IsOkToSpeak( category, true ) ) @@ -1876,13 +1876,13 @@ bool CAI_PlayerAlly::IsAllowedToSpeakFollowup( AIConcept_t concept, CBaseEntity } } - if ( !pSpeechManager->ConceptDelayExpired( concept ) ) + if ( !pSpeechManager->ConceptDelayExpired( aiconcept ) ) return false; - if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( concept ) ) + if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( aiconcept ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( aiconcept ) ) return false; return true; @@ -1891,11 +1891,11 @@ bool CAI_PlayerAlly::IsAllowedToSpeakFollowup( AIConcept_t concept, CBaseEntity //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) +bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) { - if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) + if ( IsAllowedToSpeak( aiconcept, bRespondingToPlayer ) ) { - return Speak( concept, modifiers, pszOutResponseChosen, bufsize ); + return Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize ); } return false; } @@ -1903,11 +1903,11 @@ bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, #ifdef MAPBASE //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t concept, AI_CriteriaSet& modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) +bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t aiconcept, AI_CriteriaSet& modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) { - if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) + if ( IsAllowedToSpeak( aiconcept, bRespondingToPlayer ) ) { - return Speak( concept, modifiers, pszOutResponseChosen, bufsize ); + return Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize ); } return false; } @@ -1946,10 +1946,10 @@ void CAI_PlayerAlly::ModifyOrAppendCriteria( AI_CriteriaSet& set ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t aiconcept, AI_Response *response ) { CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - pSpeechManager->OnSpokeConcept( this, concept, response ); + pSpeechManager->OnSpokeConcept( this, aiconcept, response ); #ifndef MAPBASE // This has been moved directly to CAI_Expresser if( response != NULL && (response->GetParams()->flags & AI_ResponseParams::RG_WEAPONDELAY) ) diff --git a/src/game/server/ai_playerally.h b/src/game/server/ai_playerally.h index a15cfc6fd3b..fac140beb37 100644 --- a/src/game/server/ai_playerally.h +++ b/src/game/server/ai_playerally.h @@ -190,7 +190,7 @@ enum AIConceptFlags_t struct ConceptInfo_t { - AIConcept_t concept; + AIConcept_t aiconcept; ConceptCategory_t category; float minGlobalCategoryDelay; float maxGlobalCategoryDelay; @@ -214,12 +214,12 @@ class CAI_AllySpeechManager : public CLogicalEntity void AddCustomConcept( const ConceptInfo_t &conceptInfo ); ConceptCategoryInfo_t *GetConceptCategoryInfo( ConceptCategory_t category ); - ConceptInfo_t *GetConceptInfo( AIConcept_t concept ); - void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ); + ConceptInfo_t *GetConceptInfo( AIConcept_t aiconcept ); + void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t aiconcept, AI_Response *response ); void SetCategoryDelay( ConceptCategory_t category, float minDelay, float maxDelay = 0.0 ); bool CategoryDelayExpired( ConceptCategory_t category ); - bool ConceptDelayExpired( AIConcept_t concept ); + bool ConceptDelayExpired( AIConcept_t aiconcept ); private: @@ -260,7 +260,7 @@ enum AISpeechTargetSearchFlags_t struct AISpeechSelection_t { - std::string concept; + std::string aiconcept; AI_Response Response; EHANDLE hSpeechTarget; }; @@ -359,14 +359,14 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- virtual bool SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelection ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ); + virtual void PostSpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response ); bool SelectQuestionFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection ); bool SelectAnswerFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection, bool bRespondingToHello ); //--------------------------------- - bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); - void SetPendingSpeech( AIConcept_t concept, AI_Response &Response ); + bool SelectSpeechResponse( AIConcept_t aiconcept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); + void SetPendingSpeech( AIConcept_t aiconcept, AI_Response &Response ); void ClearPendingSpeech(); bool HasPendingSpeech() { return !m_PendingConcept.empty(); } @@ -389,14 +389,14 @@ class CAI_PlayerAlly : public CAI_BaseActor bool IsOkToCombatSpeak( void ); bool IsOkToSpeakInResponseToPlayer( void ); - bool ShouldSpeakRandom( AIConcept_t concept, int iChance ); - bool IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer = false ); + bool ShouldSpeakRandom( AIConcept_t aiconcept, int iChance ); + bool IsAllowedToSpeak( AIConcept_t aiconcept, bool bRespondingToPlayer = false ); #ifdef MAPBASE - bool IsAllowedToSpeakFollowup( AIConcept_t concept, CBaseEntity *pIssuer, bool bSpecific ); + bool IsAllowedToSpeakFollowup( AIConcept_t aiconcept, CBaseEntity *pIssuer, bool bSpecific ); #endif - virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + virtual bool SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); #ifdef MAPBASE - virtual bool SpeakIfAllowed( AIConcept_t concept, AI_CriteriaSet& modifiers, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + virtual bool SpeakIfAllowed( AIConcept_t aiconcept, AI_CriteriaSet& modifiers, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); #endif void ModifyOrAppendCriteria( AI_CriteriaSet& set ); @@ -411,7 +411,7 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- - void OnSpokeConcept( AIConcept_t concept, AI_Response *response ); + void OnSpokeConcept( AIConcept_t aiconcept, AI_Response *response ); void OnStartSpeaking(); // Inputs @@ -424,7 +424,7 @@ class CAI_PlayerAlly : public CAI_BaseActor void InputMakeGameEndAlly( inputdata_t &inputdata ); void InputMakeRegularAlly( inputdata_t &inputdata ); #ifdef MAPBASE - bool AskQuestionNow( CBaseEntity *pSpeechTarget = NULL, int iQARandomNumber = -1, const char *concept = TLK_QUESTION ); + bool AskQuestionNow( CBaseEntity *pSpeechTarget = NULL, int iQARandomNumber = -1, const char *aiconcept = TLK_QUESTION ); void InputAskQuestion( inputdata_t &inputdata ); #endif void InputAnswerQuestion( inputdata_t &inputdata ); diff --git a/src/game/server/ai_speech.h b/src/game/server/ai_speech.h index 185891f02d1..a0454507878 100644 --- a/src/game/server/ai_speech.h +++ b/src/game/server/ai_speech.h @@ -120,7 +120,7 @@ class AI_Response; class CAI_ExpresserSink { public: - virtual void OnSpokeConcept( AIConcept_t concept, AI_Response *response ) {}; + virtual void OnSpokeConcept( AIConcept_t aiconcept, AI_Response *response ) {}; virtual void OnStartSpeaking() {} virtual bool UseSemaphore() { return true; } }; @@ -159,19 +159,19 @@ class CAI_Expresser : public IResponseFilter // -------------------------------- - bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #ifdef MAPBASE - bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ); + bool Speak( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + AI_Response *SpeakFindResponse( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers ); void MergeModifiers( AI_CriteriaSet& set, const char *modifiers ); #endif // These two methods allow looking up a response and dispatching it to be two different steps - bool SpeakFindResponse( AI_Response &response, AIConcept_t concept, const char *modifiers = NULL ); + bool SpeakFindResponse( AI_Response &response, AIConcept_t aiconcept, const char *modifiers = NULL ); #ifdef MAPBASE - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, IRecipientFilter *filter = NULL, const AI_CriteriaSet *modifiers = NULL ); + bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response &response, IRecipientFilter *filter = NULL, const AI_CriteriaSet *modifiers = NULL ); #else - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, IRecipientFilter *filter = NULL ); + bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response &response, IRecipientFilter *filter = NULL ); #endif float GetResponseDuration( AI_Response &response ); @@ -194,11 +194,11 @@ class CAI_Expresser : public IResponseFilter // -------------------------------- - bool CanSpeakConcept( AIConcept_t concept ); - bool SpokeConcept( AIConcept_t concept ); - float GetTimeSpokeConcept( AIConcept_t concept ); // returns -1 if never - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ); - void ClearSpokeConcept( AIConcept_t concept ); + bool CanSpeakConcept( AIConcept_t aiconcept ); + bool SpokeConcept( AIConcept_t aiconcept ); + float GetTimeSpokeConcept( AIConcept_t aiconcept ); // returns -1 if never + void SetSpokeConcept( AIConcept_t aiconcept, AI_Response *response, bool bCallback = true ); + void ClearSpokeConcept( AIConcept_t aiconcept ); #ifdef MAPBASE AIConcept_t GetLastSpokeConcept( AIConcept_t excludeConcept = NULL ); @@ -218,7 +218,7 @@ class CAI_Expresser : public IResponseFilter bool ScriptSpeakRawScene( char const *soundname, float delay ) { return SpeakRawScene( soundname, delay, NULL ); } bool ScriptSpeakAutoGeneratedScene( char const *soundname, float delay ) { return SpeakAutoGeneratedScene( soundname, delay ); } int ScriptSpeakRawSentence( char const *pszSentence, float delay ) { return SpeakRawSentence( pszSentence, delay ); } - bool ScriptSpeak( char const *concept, const char *modifiers ) { return Speak( concept, modifiers[0] != '\0' ? modifiers : NULL ); } + bool ScriptSpeak( char const *aiconcept, const char *modifiers ) { return Speak( aiconcept, modifiers[0] != '\0' ? modifiers : NULL ); } #endif protected: @@ -316,18 +316,18 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink public: virtual void NoteSpeaking( float duration, float delay ); - virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #ifdef MAPBASE - virtual bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #endif // These two methods allow looking up a response and dispatching it to be two different steps - bool SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers = NULL ); + bool SpeakFindResponse( AI_Response& response, AIConcept_t aiconcept, const char *modifiers = NULL ); #ifdef MAPBASE - bool SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ); + bool SpeakFindResponse( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers ); #endif - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response& response ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response& response ) { return; } + bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response& response ); + virtual void PostSpeakDispatchResponse( AIConcept_t aiconcept, AI_Response& response ) { return; } float GetResponseDuration( AI_Response& response ); float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); } @@ -336,9 +336,9 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink bool CanSpeak() { return this->GetExpresser()->CanSpeak(); } bool CanSpeakAfterMyself() { return this->GetExpresser()->CanSpeakAfterMyself(); } - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( concept, response, bCallback ); } - float GetTimeSpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->GetTimeSpokeConcept( concept ); } - bool SpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->SpokeConcept( concept ); } + void SetSpokeConcept( AIConcept_t aiconcept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( aiconcept, response, bCallback ); } + float GetTimeSpokeConcept( AIConcept_t aiconcept ) { return this->GetExpresser()->GetTimeSpokeConcept( aiconcept ); } + bool SpokeConcept( AIConcept_t aiconcept ) { return this->GetExpresser()->SpokeConcept( aiconcept ); } protected: int PlaySentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -360,10 +360,10 @@ inline void CAI_ExpresserHost::NoteSpeaking( float duration, float del //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); - return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return this->GetExpresser()->Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize, filter ); } #ifdef MAPBASE @@ -371,10 +371,10 @@ inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char // Version of Speak() that takes a direct AI_CriteriaSet for modifiers. //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); - return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return this->GetExpresser()->Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize, filter ); } #endif @@ -414,29 +414,29 @@ inline IResponseSystem *CAI_ExpresserHost::GetResponseSystem() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers /*= NULL*/ ) +inline bool CAI_ExpresserHost::SpeakFindResponse( AI_Response& response, AIConcept_t aiconcept, const char *modifiers /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( response, concept, modifiers ); + return this->GetExpresser()->SpeakFindResponse( response, aiconcept, modifiers ); } #ifdef MAPBASE //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers ) { - return this->GetExpresser()->SpeakFindResponse( concept, modifiers ); + return this->GetExpresser()->SpeakFindResponse( aiconcept, modifiers ); } #endif //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t concept, AI_Response& response ) +inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response& response ) { - if ( this->GetExpresser()->SpeakDispatchResponse( concept, response ) ) + if ( this->GetExpresser()->SpeakDispatchResponse( aiconcept, response ) ) { - PostSpeakDispatchResponse( concept, response ); + PostSpeakDispatchResponse( aiconcept, response ); return true; } diff --git a/src/game/server/ai_speech_new.cpp b/src/game/server/ai_speech_new.cpp index 2c80166c714..020d62647d3 100644 --- a/src/game/server/ai_speech_new.cpp +++ b/src/game/server/ai_speech_new.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -484,8 +484,8 @@ void CAI_Expresser::TestAllResponses() responses[i].GetResponse( response, sizeof( response ) ); Msg( "Response: %s\n", response ); - AIConcept_t concept; - SpeakDispatchResponse( concept, &responses[i], NULL ); + AIConcept_t aiconcept; + SpeakDispatchResponse( aiconcept, &responses[i], NULL ); } } } @@ -519,10 +519,10 @@ static void ModifyOrAppendGlobalCriteria( AI_CriteriaSet * RESTRICT outputSet ) } -void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &concept, const char * RESTRICT modifiers ) +void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &aiconcept, const char * RESTRICT modifiers ) { // Always include the concept name - outputSet->AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + outputSet->AppendCriteria( "concept", aiconcept, CONCEPT_WEIGHT ); #if 1 outputSet->Merge( modifiers ); @@ -579,8 +579,8 @@ void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const A // NULL - // Output : AI_Response //----------------------------------------------------------------------------- -// AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ ) -bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria ) +// AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t aiconcept, const char *modifiers /*= NULL*/ ) +bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &aiconcept, AI_CriteriaSet *criteria ) { VPROF("CAI_Expresser::FindResponse"); IResponseSystem *rs = GetOuter()->GetResponseSystem(); @@ -601,7 +601,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &c #if 0 // this is the old technique, where we always gathered criteria in this function AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", aiconcept, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -639,7 +639,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &c AI_CriteriaSet localCriteriaSet; // put it on the stack so we don't deal with new/delete if (criteria == NULL) { - GatherCriteria( &localCriteriaSet, concept, NULL ); + GatherCriteria( &localCriteriaSet, aiconcept, NULL ); criteria = &localCriteriaSet; } #endif @@ -670,11 +670,11 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &c char response[ 256 ]; outResponse.GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)aiconcept, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)aiconcept ); } } } @@ -691,7 +691,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &c if ( outResponse.IsEmpty() ) { - // AssertMsg2( false, "RR: %s got empty but valid response for %s", GetOuter()->GetDebugName(), concept.GetStringConcept() ); + // AssertMsg2( false, "RR: %s got empty but valid response for %s", GetOuter()->GetDebugName(), aiconcept.GetStringConcept() ); return false; } else @@ -708,7 +708,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &c // NULL - // Output : bool : true on success, false on fail //----------------------------------------------------------------------------- -AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConcept_t &concept, AI_CriteriaSet *criteria ) +AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConcept_t &aiconcept, AI_CriteriaSet *criteria ) { Assert(response); @@ -722,7 +722,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConc #if 0 AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", aiconcept, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -782,11 +782,11 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConc char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, aiconcept, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, aiconcept ); } } } @@ -813,7 +813,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConc // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) { char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); @@ -824,14 +824,14 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res soundlevel_t soundlevel = result->GetSoundLevel(); - if ( IsSpeaking() && concept[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) + if ( IsSpeaking() && aiconcept[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) { const char *entityName = STRING( GetOuter()->GetEntityName() ); if ( GetOuter()->IsPlayer() ) { entityName = ToBasePlayer( GetOuter() )->GetPlayerName(); } - CGMsg( 2, CON_GROUP_SPEECH_AI, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + CGMsg( 2, CON_GROUP_SPEECH_AI, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)aiconcept ); // Tracker 15911: Can break the game if we stop an imported map placed lcs here, so only // cancel actor out of instanced scripted scenes. ywb @@ -840,7 +840,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res if ( IsRunningScriptedScene( GetOuter() ) ) { - CGMsg( 1, CON_GROUP_SPEECH_AI, "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + CGMsg( 1, CON_GROUP_SPEECH_AI, "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)aiconcept ); return false; } } @@ -1003,7 +1003,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res { Vector vPrintPos; GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos ); - NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)concept, response ), true, 1.5 ); + NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)aiconcept, response ), true, 1.5 ); } #ifdef MAPBASE @@ -1062,7 +1062,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res GetOuter()->AddContext( result->GetContext() ); } #endif - SetSpokeConcept( concept, result ); + SetSpokeConcept( aiconcept, result ); } else { @@ -1252,13 +1252,13 @@ void CAI_Expresser::MarkResponseAsUsed( AI_Response *response ) // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::Speak( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - concept.SetSpeaker(GetOuter()); + aiconcept.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, aiconcept, modifiers); - return Speak( concept, &criteria, pszOutResponseChosen, bufsize, filter ); + return Speak( aiconcept, &criteria, pszOutResponseChosen, bufsize, filter ); } @@ -1266,7 +1266,7 @@ bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/ //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( const AIConcept_t &concept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) +bool CAI_Expresser::Speak( const AIConcept_t &aiconcept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -1276,15 +1276,15 @@ bool CAI_Expresser::Speak( const AIConcept_t &concept, AI_CriteriaSet * RESTRICT GetOuter()->ModifyOrAppendDerivedCriteria(*criteria); AI_Response result; - if ( !FindResponse( result, concept, criteria ) ) + if ( !FindResponse( result, aiconcept, criteria ) ) { return false; } - SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); - // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); + SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)aiconcept, gpGlobals->curtime ); + // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), aiconcept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, criteria, filter ); + bool spoke = SpeakDispatchResponse( aiconcept, &result, criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -1476,10 +1476,10 @@ bool CAI_Expresser::CanSpeakAfterMyself() } //------------------------------------- -bool CAI_Expresser::CanSpeakConcept( const AIConcept_t &concept ) +bool CAI_Expresser::CanSpeakConcept( const AIConcept_t &aiconcept ) { // Not in history? - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( aiconcept ); if ( iter == m_ConceptHistories.InvalidIndex() ) { return true; @@ -1508,16 +1508,16 @@ bool CAI_Expresser::CanSpeakConcept( const AIConcept_t &concept ) //------------------------------------- -bool CAI_Expresser::SpokeConcept( const AIConcept_t &concept ) +bool CAI_Expresser::SpokeConcept( const AIConcept_t &aiconcept ) { - return GetTimeSpokeConcept( concept ) != -1.f; + return GetTimeSpokeConcept( aiconcept ) != -1.f; } //------------------------------------- -float CAI_Expresser::GetTimeSpokeConcept( const AIConcept_t &concept ) +float CAI_Expresser::GetTimeSpokeConcept( const AIConcept_t &aiconcept ) { - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( aiconcept ); if ( iter == m_ConceptHistories.InvalidIndex() ) return -1; @@ -1527,14 +1527,14 @@ float CAI_Expresser::GetTimeSpokeConcept( const AIConcept_t &concept ) //------------------------------------- -void CAI_Expresser::SetSpokeConcept( const AIConcept_t &concept, AI_Response *response, bool bCallback ) +void CAI_Expresser::SetSpokeConcept( const AIConcept_t &aiconcept, AI_Response *response, bool bCallback ) { - int idx = m_ConceptHistories.Find( concept ); + int idx = m_ConceptHistories.Find( aiconcept ); if ( idx == m_ConceptHistories.InvalidIndex() ) { ConceptHistory_t h; h.timeSpoken = gpGlobals->curtime; - idx = m_ConceptHistories.Insert( concept, h ); + idx = m_ConceptHistories.Insert( aiconcept, h ); } ConceptHistory_t *slot = &m_ConceptHistories[ idx ]; @@ -1547,14 +1547,14 @@ void CAI_Expresser::SetSpokeConcept( const AIConcept_t &concept, AI_Response *re } if ( bCallback ) - GetSink()->OnSpokeConcept( concept, response ); + GetSink()->OnSpokeConcept( aiconcept, response ); } //------------------------------------- -void CAI_Expresser::ClearSpokeConcept( const AIConcept_t &concept ) +void CAI_Expresser::ClearSpokeConcept( const AIConcept_t &aiconcept ) { - m_ConceptHistories.Remove( concept ); + m_ConceptHistories.Remove( aiconcept ); } #ifdef MAPBASE diff --git a/src/game/server/ai_speech_new.h b/src/game/server/ai_speech_new.h index 8290d471bb9..faae67da0e9 100644 --- a/src/game/server/ai_speech_new.h +++ b/src/game/server/ai_speech_new.h @@ -123,15 +123,15 @@ inline bool CompareConcepts( AIConcept_t c1, AIConcept_t c2 ) class CAI_ExpresserSink { public: - virtual void OnSpokeConcept( AIConcept_t concept, AI_Response *response ) {}; + virtual void OnSpokeConcept( AIConcept_t aiconcept, AI_Response *response ) {}; virtual void OnStartSpeaking() {} virtual bool UseSemaphore() { return true; } #ifdef MAPBASE // Works around issues with CAI_ExpresserHost<> class hierarchy virtual CAI_Expresser *GetSinkExpresser() { return NULL; } - virtual bool IsAllowedToSpeakFollowup( AIConcept_t concept, CBaseEntity *pIssuer, bool bSpecific ) { return true; } - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ) { return false; } + virtual bool IsAllowedToSpeakFollowup( AIConcept_t aiconcept, CBaseEntity *pIssuer, bool bSpecific ) { return true; } + virtual bool Speak( AIConcept_t aiconcept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ) { return false; } #endif }; @@ -169,20 +169,20 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - bool Speak( const AIConcept_t &concept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( const AIConcept_t &aiconcept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); // Given modifiers (which are colon-delimited strings), fill out a criteria set including this // character's contexts and the ones in the modifier. This lets us hang on to them after a call // to SpeakFindResponse. - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &aiconcept, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps - // AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); - // AI_Response *SpeakFindResponse( AIConcept_t &concept, AI_CriteriaSet *criteria ); - // Find the appropriate response for the given concept. Return false if none found. + // AI_Response *SpeakFindResponse( AIConcept_t aiconcept, const char *modifiers = NULL ); + // AI_Response *SpeakFindResponse( AIConcept_t &aiconcept, AI_CriteriaSet *criteria ); + // Find the appropriate response for the given aiconcept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *modifiers = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + bool FindResponse( AI_Response &outResponse, const AIConcept_t &aiconcept, AI_CriteriaSet *modifiers = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); float GetResponseDuration( AI_Response *response ); #ifdef MAPBASE @@ -213,11 +213,11 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool CanSpeakConcept( const AIConcept_t &concept ); - bool SpokeConcept( const AIConcept_t &concept ); - float GetTimeSpokeConcept( const AIConcept_t &concept ); // returns -1 if never - void SetSpokeConcept( const AIConcept_t &concept, AI_Response *response, bool bCallback = true ); - void ClearSpokeConcept( const AIConcept_t &concept ); + bool CanSpeakConcept( const AIConcept_t &aiconcept ); + bool SpokeConcept( const AIConcept_t &aiconcept ); + float GetTimeSpokeConcept( const AIConcept_t &aiconcept ); // returns -1 if never + void SetSpokeConcept( const AIConcept_t &aiconcept, AI_Response *response, bool bCallback = true ); + void ClearSpokeConcept( const AIConcept_t &aiconcept ); #ifdef MAPBASE AIConcept_t GetLastSpokeConcept( AIConcept_t excludeConcept = NULL ); @@ -237,7 +237,7 @@ class CAI_Expresser : public ResponseRules::IResponseFilter bool ScriptSpeakRawScene( char const *soundname, float delay ) { return SpeakRawScene( soundname, delay, NULL ); } bool ScriptSpeakAutoGeneratedScene( char const *soundname, float delay ) { return SpeakAutoGeneratedScene( soundname, delay ); } int ScriptSpeakRawSentence( char const *pszSentence, float delay ) { return SpeakRawSentence( pszSentence, delay ); } - bool ScriptSpeak( char const *concept, const char *modifiers ) { return Speak( concept, modifiers[0] != '\0' ? modifiers : NULL ); } + bool ScriptSpeak( char const *aiconcept, const char *modifiers ) { return Speak( aiconcept, modifiers[0] != '\0' ? modifiers : NULL ); } #endif // helper used in dealing with RESPONSE_ENTITYIO @@ -335,29 +335,29 @@ class CAI_ExpresserHost : public BASE_NPC, public CAI_ExpresserSink virtual void NoteSpeaking( float duration, float delay ); - virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t aiconcept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #ifdef MAPBASE - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ) { return Speak( concept, &modifiers, pszOutResponseChosen, bufsize, filter ); } + virtual bool Speak( AIConcept_t aiconcept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ) { return Speak( aiconcept, &modifiers, pszOutResponseChosen, bufsize, filter ); } #endif - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &aiconcept, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps #ifdef MAPBASE - //AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ); - inline bool SpeakDispatchResponse( const AIConcept_t &concept, AI_Response &response, AI_CriteriaSet *criteria = NULL ) { return SpeakDispatchResponse( concept, &response, criteria ); } + //AI_Response *SpeakFindResponse( AIConcept_t aiconcept, const AI_CriteriaSet& modifiers ); + inline bool SpeakDispatchResponse( const AIConcept_t &aiconcept, AI_Response &response, AI_CriteriaSet *criteria = NULL ) { return SpeakDispatchResponse( aiconcept, &response, criteria ); } #endif - bool SpeakFindResponse( AI_Response& outResponse, const AIConcept_t &concept, const char *modifiers = NULL ); - // AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); - // AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria ); - // AI_Response *SpeakFindResponse( AIConcept_t concept ); - // Find the appropriate response for the given concept. Return false if none found. + bool SpeakFindResponse( AI_Response& outResponse, const AIConcept_t &aiconcept, const char *modifiers = NULL ); + // AI_Response * SpeakFindResponse( AIConcept_t aiconcept, const char *modifiers = NULL ); + // AI_Response *SpeakFindResponse( AIConcept_t aiconcept, AI_CriteriaSet *criteria ); + // AI_Response *SpeakFindResponse( AIConcept_t aiconcept ); + // Find the appropriate response for the given aiconcept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria = NULL ); + bool FindResponse( AI_Response &outResponse, const AIConcept_t &aiconcept, AI_CriteriaSet *criteria = NULL ); - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria = NULL ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; } + bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response, AI_CriteriaSet *criteria = NULL ); + virtual void PostSpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response ) { return; } float GetResponseDuration( AI_Response *response ); float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); } @@ -366,9 +366,9 @@ class CAI_ExpresserHost : public BASE_NPC, public CAI_ExpresserSink bool CanSpeak() { return this->GetExpresser()->CanSpeak(); } bool CanSpeakAfterMyself() { return this->GetExpresser()->CanSpeakAfterMyself(); } - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( concept, response, bCallback ); } - float GetTimeSpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->GetTimeSpokeConcept( concept ); } - bool SpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->SpokeConcept( concept ); } + void SetSpokeConcept( AIConcept_t aiconcept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( aiconcept, response, bCallback ); } + float GetTimeSpokeConcept( AIConcept_t aiconcept ) { return this->GetExpresser()->GetTimeSpokeConcept( aiconcept ); } + bool SpokeConcept( AIConcept_t aiconcept ) { return this->GetExpresser()->SpokeConcept( aiconcept ); } protected: int PlaySentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -390,24 +390,24 @@ inline void CAI_ExpresserHost::NoteSpeaking( float duration, float del //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); - return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return this->GetExpresser()->Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t aiconcept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); CAI_Expresser * const RESTRICT pExpresser = this->GetExpresser(); - concept.SetSpeaker(this); + aiconcept.SetSpeaker(this); // add in any local criteria to the one passed on the command line. - pExpresser->GatherCriteria( pCriteria, concept, NULL ); + pExpresser->GatherCriteria( pCriteria, aiconcept, NULL ); // call the "I have aleady gathered criteria" version of Expresser::Speak - return pExpresser->Speak( concept, pCriteria, pszOutResponseChosen, bufsize, filter ); + return pExpresser->Speak( aiconcept, pCriteria, pszOutResponseChosen, bufsize, filter ); } @@ -451,9 +451,9 @@ inline IResponseSystem *CAI_ExpresserHost::GetResponseSystem() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &concept, const char *modifiers ) +inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &aiconcept, const char *modifiers ) { - return this->GetExpresser()->GatherCriteria( outputCriteria, concept, modifiers ); + return this->GetExpresser()->GatherCriteria( outputCriteria, aiconcept, modifiers ); } @@ -461,19 +461,19 @@ inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputC //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakFindResponse(AI_Response& outResponse, const AIConcept_t &concept, const char *modifiers /*= NULL*/ ) +inline bool CAI_ExpresserHost::SpeakFindResponse(AI_Response& outResponse, const AIConcept_t &aiconcept, const char *modifiers /*= NULL*/ ) { AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); - return FindResponse( outResponse, concept, &criteria ); + GatherCriteria(&criteria, aiconcept, modifiers); + return FindResponse( outResponse, aiconcept, &criteria ); } #else //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &concept, const char *modifiers /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &aiconcept, const char *modifiers /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, modifiers ); + return this->GetExpresser()->SpeakFindResponse( aiconcept, modifiers ); } #endif @@ -481,9 +481,9 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConc //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &concept, AI_CriteriaSet *criteria /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &aiconcept, AI_CriteriaSet *criteria /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, criteria ); + return this->GetExpresser()->SpeakFindResponse( aiconcept, criteria ); } @@ -492,11 +492,11 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( const AIConc // class that generates a one off. //----------------------------------------------------------------------------- template -inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &concept ) +inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( const AIConcept_t &aiconcept ) { AI_CriteriaSet criteria; - GatherCriteria( &criteria, concept, NULL ); - return this->GetExpresser()->SpeakFindResponse( concept, &criteria ); + GatherCriteria( &criteria, aiconcept, NULL ); + return this->GetExpresser()->SpeakFindResponse( aiconcept, &criteria ); } #endif @@ -504,20 +504,20 @@ inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( const AICon //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, const AIConcept_t &aiconcept, AI_CriteriaSet *criteria ) { - return this->GetExpresser()->FindResponse( outResponse, concept, criteria ); + return this->GetExpresser()->FindResponse( outResponse, aiconcept, criteria ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response, AI_CriteriaSet *criteria ) { - if ( this->GetExpresser()->SpeakDispatchResponse( concept, response, criteria ) ) + if ( this->GetExpresser()->SpeakDispatchResponse( aiconcept, response, criteria ) ) { - PostSpeakDispatchResponse( concept, response ); + PostSpeakDispatchResponse( aiconcept, response ); return true; } @@ -692,15 +692,15 @@ class CAI_ExpresserWithFollowup : public CAI_Expresser CAI_ExpresserWithFollowup( CBaseFlex *pOuter = NULL ) : CAI_Expresser(pOuter), m_pPostponedFollowup(NULL) {}; - virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t aiconcept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); virtual void SpeakDispatchFollowup( AI_ResponseFollowup &followup ); virtual void OnSpeechFinished(); typedef CAI_Expresser BaseClass; protected: - static void DispatchFollowupThroughQueue( const AIConcept_t &concept, + static void DispatchFollowupThroughQueue( const AIConcept_t &aiconcept, const char *criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, diff --git a/src/game/server/ai_speechqueue.cpp b/src/game/server/ai_speechqueue.cpp index 58fccde6af1..1a34a155fd9 100644 --- a/src/game/server/ai_speechqueue.cpp +++ b/src/game/server/ai_speechqueue.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -31,7 +31,7 @@ CResponseQueue::CResponseQueue( int queueSize ) : m_Queue(queueSize), m_Expresse {}; /// Add a deferred response. -void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Add( const AIConcept_t &aiconcept, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, @@ -41,12 +41,12 @@ void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch // Add a response. AssertMsg( m_Queue.Count() < AI_RESPONSE_QUEUE_SIZE, "AI Response queue overfilled." ); QueueType_t::IndexLocalType_t idx = m_Queue.AddToTail(); - m_Queue[idx].Init( concept, contexts, time, targetspec, pIssuer ); + m_Queue[idx].Init( aiconcept, contexts, time, targetspec, pIssuer ); } /// Remove a deferred response matching the concept and issuer. -void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Remove( const AIConcept_t &aiconcept, ///< concept to dispatch CBaseEntity * const RESTRICT pIssuer ///< the entity issuing the response, if one exists. ) RESTRICT { @@ -57,7 +57,7 @@ void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispat CDeferredResponse &response = m_Queue[idx]; QueueType_t::IndexLocalType_t previdx = idx; // advance the index immediately because we may be deleting the "current" element idx = m_Queue.Next(idx); // is now the next index - if ( CompareConcepts( response.m_concept, concept ) && // if concepts match and + if ( CompareConcepts( response.m_concept, aiconcept ) && // if concepts match and ( !pIssuer || ( response.m_hIssuer.Get() == pIssuer ) ) // issuer is null, or matches the one in the response ) { @@ -220,11 +220,11 @@ void CResponseQueue::CDeferredResponse::Quash() } #ifdef MAPBASE -void CResponseQueue::AppendFollowupCriteria( AIConcept_t concept, AI_CriteriaSet &set, CAI_Expresser *pEx, +void CResponseQueue::AppendFollowupCriteria( AIConcept_t aiconcept, AI_CriteriaSet &set, CAI_Expresser *pEx, CAI_ExpresserSink *pSink, CBaseEntity *pTarget, CBaseEntity *pIssuer, DeferredResponseTarget_t nTargetType ) { // Allows control over which followups interrupt speech routines - set.AppendCriteria( "followup_allowed_to_speak", (pSink->IsAllowedToSpeakFollowup( concept, pIssuer, nTargetType == kDRT_SPECIFIC )) ? "1" : "0" ); + set.AppendCriteria( "followup_allowed_to_speak", (pSink->IsAllowedToSpeakFollowup( aiconcept, pIssuer, nTargetType == kDRT_SPECIFIC )) ? "1" : "0" ); set.AppendCriteria( "followup_target_type", UTIL_VarArgs( "%i", (int)nTargetType ) ); diff --git a/src/game/server/ai_speechqueue.h b/src/game/server/ai_speechqueue.h index 87ab064f81b..103cef83822 100644 --- a/src/game/server/ai_speechqueue.h +++ b/src/game/server/ai_speechqueue.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: An event queue of AI concepts that dispatches them to appropriate characters. // @@ -73,7 +73,7 @@ class CResponseQueue */ CFollowupTargetSpec_t m_Target; - inline void Init( const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); + inline void Init( const AIConcept_t &aiconcept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); inline bool IsQuashed() { return !m_Target.IsValid(); } void Quash(); ///< make this response invalid. }; @@ -85,7 +85,7 @@ class CResponseQueue CResponseQueue( int queueSize ); /// Add a deferred response. - void Add( const AIConcept_t &concept, ///< concept to dispatch + void Add( const AIConcept_t &aiconcept, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, ///< the contexts that come with it (may be NULL) float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, /// All information necessary to target this response @@ -93,7 +93,7 @@ class CResponseQueue ); /// Remove all deferred responses matching the concept and issuer. - void Remove( const AIConcept_t &concept, ///< concept to dispatch + void Remove( const AIConcept_t &aiconcept, ///< concept to dispatch CBaseEntity * const pIssuer = NULL ///< the entity issuing the response, if one exists. ); @@ -117,7 +117,7 @@ class CResponseQueue inline CBaseEntity *GetExpresserHost(int which) const; #ifdef MAPBASE - void AppendFollowupCriteria( AIConcept_t concept, AI_CriteriaSet &set, CAI_Expresser *pEx, + void AppendFollowupCriteria( AIConcept_t aiconcept, AI_CriteriaSet &set, CAI_Expresser *pEx, CAI_ExpresserSink *pSink, CBaseEntity *pTarget, CBaseEntity *pIssuer, DeferredResponseTarget_t nTargetType ); #endif @@ -145,9 +145,9 @@ class CResponseQueue CUtlVector m_ExpresserTargets; // a list of legitimate expresser targets }; -inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) +inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &aiconcept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) { - m_concept = concept; + m_concept = aiconcept; m_fDispatchTime = dtime; /* m_iTargetType = targetType; @@ -210,32 +210,32 @@ extern CResponseQueueManager g_ResponseQueueManager; // Handy global helper funcs /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &aiconcept, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, NULL, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( aiconcept, NULL, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &aiconcept, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( aiconcept, &criteria, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &aiconcept, ///< concept name to say const EHANDLE &target, ///< which entity shall speak float delay, ///< how far in the future to speak const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, + return g_ResponseQueueManager.GetQueue()->Add( aiconcept, &criteria, gpGlobals->curtime + delay, CResponseQueue::CFollowupTargetSpec_t(target), pIssuer ); } diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index c077aee6284..aa7a4bbb497 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -10901,7 +10901,7 @@ bool CBaseEntity::ScriptDispatchInteraction( int interactionType, HSCRIPT data, #ifdef MAPBASE -extern int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, char *substring, int checklen = 0 ); +extern int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, const char *substring, int checklen = 0 ); //------------------------------------------------------------------------------ // Purpose: Create an entity of the given type diff --git a/src/game/server/baseentity.h b/src/game/server/baseentity.h index 8c039cd9b1d..89926332fe9 100644 --- a/src/game/server/baseentity.h +++ b/src/game/server/baseentity.h @@ -1356,21 +1356,21 @@ class CBaseEntity : public IServerEntity #endif // !PLATFORM_64BITS void FunctionCheck( void *pFunction, const char *name ); - ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name ) { COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE ); m_pfnTouch = func; FunctionCheck( *(reinterpret_cast(&m_pfnTouch)), name ); return func; } - USEPTR UseSet( USEPTR func, char *name ) + USEPTR UseSet( USEPTR func, const char *name ) { COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE ); m_pfnUse = func; FunctionCheck( *(reinterpret_cast(&m_pfnUse)), name ); return func; } - ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, const char *name ) { COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE ); m_pfnBlocked = func; diff --git a/src/game/server/basemultiplayerplayer.cpp b/src/game/server/basemultiplayerplayer.cpp index 043330962d4..615ddc2ab1d 100644 --- a/src/game/server/basemultiplayerplayer.cpp +++ b/src/game/server/basemultiplayerplayer.cpp @@ -69,13 +69,13 @@ void CBaseMultiplayerPlayer::ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) +bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) { if ( !IsAlive() ) return false; - //if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) - return Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + //if ( IsAllowedToSpeak( aiconcept, bRespondingToPlayer ) ) + return Speak( aiconcept, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- @@ -89,16 +89,16 @@ IResponseSystem *CBaseMultiplayerPlayer::GetResponseSystem() } //----------------------------------------------------------------------------- -// Purpose: Doesn't actually speak the concept. Just finds a response in the system. You then have to play it yourself. +// Purpose: Doesn't actually speak the aiconcept. Just finds a response in the system. You then have to play it yourself. //----------------------------------------------------------------------------- bool CBaseMultiplayerPlayer::SpeakConcept( AI_Response &response, int iConcept ) { - // Save the current concept. + // Save the current aiconcept. m_iCurrentConcept = iConcept; #ifdef NEW_RESPONSE_SYSTEM - CAI_Concept concept(g_pszMPConcepts[iConcept]); - concept.SetSpeaker(this); - return FindResponse( response, concept ); + CAI_Concept aiconcept(g_pszMPConcepts[iConcept]); + aiconcept.SetSpeaker(this); + return FindResponse( response, aiconcept ); #else return SpeakFindResponse( g_pszMPConcepts[iConcept] ); #endif @@ -109,7 +109,7 @@ bool CBaseMultiplayerPlayer::SpeakConcept( AI_Response &response, int iConcept ) //----------------------------------------------------------------------------- bool CBaseMultiplayerPlayer::SpeakConceptIfAllowed( int iConcept, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) { - // Save the current concept. + // Save the current aiconcept. m_iCurrentConcept = iConcept; return SpeakIfAllowed( g_pszMPConcepts[iConcept], modifiers, pszOutResponseChosen, bufsize, filter ); } diff --git a/src/game/server/basemultiplayerplayer.h b/src/game/server/basemultiplayerplayer.h index 14eaf518231..3efad7d7da5 100644 --- a/src/game/server/basemultiplayerplayer.h +++ b/src/game/server/basemultiplayerplayer.h @@ -27,7 +27,7 @@ class CBaseMultiplayerPlayer : public CAI_ExpresserHost virtual void PostConstructor( const char *szClassname ); virtual void ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet ); - virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); virtual IResponseSystem *GetResponseSystem(); bool SpeakConcept( AI_Response &response, int iConcept ); virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); diff --git a/src/game/server/episodic/ai_behavior_alyx_injured.cpp b/src/game/server/episodic/ai_behavior_alyx_injured.cpp index a762587df67..dc8944c2816 100644 --- a/src/game/server/episodic/ai_behavior_alyx_injured.cpp +++ b/src/game/server/episodic/ai_behavior_alyx_injured.cpp @@ -479,16 +479,16 @@ void CAI_BehaviorAlyxInjured::GatherConditions( void ) //----------------------------------------------------------------------------- // Purpose: Speak a concept if we're able to //----------------------------------------------------------------------------- -void CAI_BehaviorAlyxInjured::SpeakIfAllowed( AIConcept_t concept ) +void CAI_BehaviorAlyxInjured::SpeakIfAllowed( AIConcept_t aiconcept ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( pExpresser == NULL ) return; // Must be able to speak the concept - if ( pExpresser->CanSpeakConcept( concept ) ) + if ( pExpresser->CanSpeakConcept( aiconcept ) ) { - pExpresser->Speak( concept ); + pExpresser->Speak( aiconcept ); } } diff --git a/src/game/server/episodic/ai_behavior_alyx_injured.h b/src/game/server/episodic/ai_behavior_alyx_injured.h index 2eb1ff197bc..bdf0634c7fc 100644 --- a/src/game/server/episodic/ai_behavior_alyx_injured.h +++ b/src/game/server/episodic/ai_behavior_alyx_injured.h @@ -75,7 +75,7 @@ class CAI_BehaviorAlyxInjured : public CAI_FollowBehavior private: - void SpeakIfAllowed( AIConcept_t concept ); + void SpeakIfAllowed( AIConcept_t aiconcept ); bool ShouldRunToCover( void ); bool ShouldRunToFollowGoal( void ); bool FindThreatDirection2D( const Vector &vecSource, Vector *vecOut ); diff --git a/src/game/server/episodic/npc_hunter.cpp b/src/game/server/episodic/npc_hunter.cpp index 0699d890616..68d1a39cdd9 100644 --- a/src/game/server/episodic/npc_hunter.cpp +++ b/src/game/server/episodic/npc_hunter.cpp @@ -6566,7 +6566,7 @@ const char *CNPC_Hunter::SelectRandomExpressionForState( NPC_STATE state ) if ( !hunter_random_expressions.GetBool() ) return NULL; - char *szExpressions[4] = + const char *szExpressions[4] = { "scenes/npc/hunter/hunter_scan.vcd", "scenes/npc/hunter/hunter_eyeclose.vcd", diff --git a/src/game/server/episodic/npc_magnusson.cpp b/src/game/server/episodic/npc_magnusson.cpp index 30e1f69783a..8d70c5b18fc 100644 --- a/src/game/server/episodic/npc_magnusson.cpp +++ b/src/game/server/episodic/npc_magnusson.cpp @@ -86,7 +86,7 @@ int CNPC_Magnusson::GetSoundInterests ( void ) void CNPC_Magnusson::Spawn() { // Allow custom model usage (mostly for monitors) - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/magnusson.mdl"; diff --git a/src/game/server/episodic/vehicle_jeep_episodic.cpp b/src/game/server/episodic/vehicle_jeep_episodic.cpp index 70057bf0155..af2d8a5798c 100644 --- a/src/game/server/episodic/vehicle_jeep_episodic.cpp +++ b/src/game/server/episodic/vehicle_jeep_episodic.cpp @@ -1502,8 +1502,8 @@ void CPropJeepEpisodic::SpawnRadarPanel() // If we're attached to an entity, spawn control panels on it instead of use CBaseAnimating *pEntityToSpawnOn = this; - char *pOrgLL = "controlpanel0_ll"; - char *pOrgUR = "controlpanel0_ur"; + const char *pOrgLL = "controlpanel0_ll"; + const char *pOrgUR = "controlpanel0_ur"; Assert( pEntityToSpawnOn ); diff --git a/src/game/server/genericactor.cpp b/src/game/server/genericactor.cpp index 9e87c963226..ad5752cbc02 100644 --- a/src/game/server/genericactor.cpp +++ b/src/game/server/genericactor.cpp @@ -216,7 +216,7 @@ class CGenericActorCustom : public CGenericActor bool KeyValue( const char *szKeyName, const char *szValue ); - void SpeakIfAllowed( const char *concept, AI_CriteriaSet *modifiers = NULL ); + void SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet *modifiers = NULL ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); void PainSound( const CTakeDamageInfo &info ); @@ -275,10 +275,10 @@ bool CGenericActorCustom::KeyValue( const char *szKeyName, const char *szValue ) //----------------------------------------------------------------------------- // Purpose: Speak concept //----------------------------------------------------------------------------- -void CGenericActorCustom::SpeakIfAllowed( const char *concept, AI_CriteriaSet *modifiers ) +void CGenericActorCustom::SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet *modifiers ) { AI_CriteriaSet empty; - Speak( concept, modifiers ? *modifiers : empty ); + Speak( aiconcept, modifiers ? *modifiers : empty ); } //----------------------------------------------------------------------------- diff --git a/src/game/server/hl2/ai_behavior_actbusy.cpp b/src/game/server/hl2/ai_behavior_actbusy.cpp index 9868049e05c..f1619ddbe33 100644 --- a/src/game/server/hl2/ai_behavior_actbusy.cpp +++ b/src/game/server/hl2/ai_behavior_actbusy.cpp @@ -1773,15 +1773,15 @@ void CAI_ActBusyBehavior::PlaySoundForActBusy( busyanimparts_t AnimPart ) if ( pExpresser ) { #ifdef NEW_RESPONSE_SYSTEM - CAI_Concept concept = STRING(pBusyAnim->iszSounds[AnimPart]); + CAI_Concept aiconcept = STRING(pBusyAnim->iszSounds[AnimPart]); #else - const char *concept = STRING(pBusyAnim->iszSounds[AnimPart]); + const char *aiconcept = STRING(pBusyAnim->iszSounds[AnimPart]); #endif // Must be able to speak the concept - if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( concept ) ) + if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( aiconcept ) ) { - pExpresser->Speak( concept ); + pExpresser->Speak( aiconcept ); } } } diff --git a/src/game/server/hl2/ai_behavior_police.cpp b/src/game/server/hl2/ai_behavior_police.cpp index 8dc5ec4008f..eb1df2c450e 100644 --- a/src/game/server/hl2/ai_behavior_police.cpp +++ b/src/game/server/hl2/ai_behavior_police.cpp @@ -144,8 +144,8 @@ void CAI_PolicingBehavior::HostSpeakSentence( const char *pSentence, SentencePri else if ( GetOuter()->GetExpresser() ) { #ifdef NEW_RESPONSE_SYSTEM - CAI_Concept concept = pSentence; - GetOuter()->GetExpresser()->Speak( concept ); + CAI_Concept aiconcept = pSentence; + GetOuter()->GetExpresser()->Speak( aiconcept ); #else GetOuter()->GetExpresser()->Speak( pSentence ); #endif @@ -174,8 +174,8 @@ void CAI_PolicingBehavior::HostSpeakSentence( const char *pSentence, const char else if ( GetOuter()->GetExpresser() ) { #ifdef NEW_RESPONSE_SYSTEM - CAI_Concept concept( pSentence ); - GetOuter()->GetExpresser()->Speak( concept, modifiers ); + CAI_Concept aiconcept( pSentence ); + GetOuter()->GetExpresser()->Speak( aiconcept, modifiers ); #else GetOuter()->GetExpresser()->Speak( pSentence, modifiers ); #endif diff --git a/src/game/server/hl2/combine_mine.cpp b/src/game/server/hl2/combine_mine.cpp index 76fa0771916..72be6b55419 100644 --- a/src/game/server/hl2/combine_mine.cpp +++ b/src/game/server/hl2/combine_mine.cpp @@ -39,7 +39,7 @@ enum #define MINE_CITIZEN_SKIN_MIN 1 #define MINE_CITIZEN_SKIN_MAX 2 -char *pszMineStateNames[] = +const char *pszMineStateNames[] = { "Dormant", "Deploy", diff --git a/src/game/server/hl2/env_speaker.cpp b/src/game/server/hl2/env_speaker.cpp index 6413023f7a3..c96daf38bbb 100644 --- a/src/game/server/hl2/env_speaker.cpp +++ b/src/game/server/hl2/env_speaker.cpp @@ -76,8 +76,8 @@ void CSpeaker::Spawn( void ) return; } -// const char *concept = (const char *)STRING( m_iszConcept ); -// if ( Q_strlen( concept ) < 1 ) +// const char *aiconcept = (const char *)STRING( m_iszConcept ); +// if ( Q_strlen( aiconcept ) < 1 ) // { // Warning( "'speaker' entity using rule set %s with empty concept string\n", soundfile ); // } diff --git a/src/game/server/hl2/npc_alyx_episodic.cpp b/src/game/server/hl2/npc_alyx_episodic.cpp index dd5a35b0dda..996b391c6ca 100644 --- a/src/game/server/hl2/npc_alyx_episodic.cpp +++ b/src/game/server/hl2/npc_alyx_episodic.cpp @@ -1507,9 +1507,9 @@ void CNPC_Alyx::DoCustomSpeechAI( void ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CNPC_Alyx::SpeakIfAllowed( AIConcept_t concept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /* = 0 */ ) +bool CNPC_Alyx::SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /* = 0 */ ) { - if ( BaseClass::SpeakIfAllowed( concept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ) ) + if ( BaseClass::SpeakIfAllowed( aiconcept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ) ) { // If we're breathing in the darkness, drop the volume quickly if ( m_sndDarknessBreathing && CSoundEnvelopeController::GetController().SoundGetVolume( m_sndDarknessBreathing ) > 0.0 ) diff --git a/src/game/server/hl2/npc_alyx_episodic.h b/src/game/server/hl2/npc_alyx_episodic.h index f24ddf67682..d0ae1aaa77f 100644 --- a/src/game/server/hl2/npc_alyx_episodic.h +++ b/src/game/server/hl2/npc_alyx_episodic.h @@ -115,7 +115,7 @@ class CNPC_Alyx : public CNPC_PlayerCompanion bool HandleInteraction(int interactionType, void *data, CBaseCombatCharacter* sourceEnt); - virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + virtual bool SpeakIfAllowed( AIConcept_t aiconcept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); void HolsterPistol(); void DrawPistol(); diff --git a/src/game/server/hl2/npc_basescanner.h b/src/game/server/hl2/npc_basescanner.h index 1a286b81131..b50ffa136db 100644 --- a/src/game/server/hl2/npc_basescanner.h +++ b/src/game/server/hl2/npc_basescanner.h @@ -100,7 +100,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot, public CDefaultPlayerP void DeathSound( const CTakeDamageInfo &info ); void AlertSound( void ); void PainSound( const CTakeDamageInfo &info ); - virtual char *GetScannerSoundPrefix( void ) { return ""; } + virtual const char *GetScannerSoundPrefix( void ) { return ""; } void ScannerEmitSound( const char *pszSoundName ); int MeleeAttack1Conditions ( float flDot, float flDist ); @@ -124,7 +124,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot, public CDefaultPlayerP void InputSetDistanceOverride( inputdata_t &inputdata ); protected: - virtual char *GetEngineSound( void ) { return NULL; } + virtual const char *GetEngineSound( void ) { return NULL; } void PlayFlySound(void); void SetBanking( float flInterval ); diff --git a/src/game/server/hl2/npc_breen.cpp b/src/game/server/hl2/npc_breen.cpp index e1409c80ccd..8e31bbfd8fc 100644 --- a/src/game/server/hl2/npc_breen.cpp +++ b/src/game/server/hl2/npc_breen.cpp @@ -84,7 +84,7 @@ void CNPC_Breen::Spawn() { // Breen is allowed to use multiple models, because he has a torso version for monitors. // He defaults to his normal model. - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/breen.mdl"; diff --git a/src/game/server/hl2/npc_citizen17.cpp b/src/game/server/hl2/npc_citizen17.cpp index 181cb7a7302..f61b9716d09 100644 --- a/src/game/server/hl2/npc_citizen17.cpp +++ b/src/game/server/hl2/npc_citizen17.cpp @@ -156,7 +156,7 @@ ConVar ai_citizen_debug_commander( "ai_citizen_debug_commander", "1" ); #define STATES_WITH_EXPRESSIONS 3 // Idle, Alert, Combat #define EXPRESSIONS_PER_STATE 1 -char *szExpressionTypes[CIT_EXP_LAST_TYPE] = +const char *szExpressionTypes[CIT_EXP_LAST_TYPE] = { "Unassigned", "Scared", @@ -166,7 +166,7 @@ char *szExpressionTypes[CIT_EXP_LAST_TYPE] = struct citizen_expression_list_t { - char *szExpressions[EXPRESSIONS_PER_STATE]; + const char *szExpressions[EXPRESSIONS_PER_STATE]; }; // Scared citizen_expression_list_t ScaredExpressions[STATES_WITH_EXPRESSIONS] = @@ -2884,9 +2884,9 @@ bool CNPC_Citizen::IsValidCommandTarget( CBaseEntity *pTarget ) } //----------------------------------------------------------------------------- -bool CNPC_Citizen::SpeakCommandResponse( AIConcept_t concept, const char *modifiers ) +bool CNPC_Citizen::SpeakCommandResponse( AIConcept_t aiconcept, const char *modifiers ) { - return SpeakIfAllowed( concept, + return SpeakIfAllowed( aiconcept, CFmtStr( "numselected:%d," "useradio:%d%s", ( GetSquad() ) ? GetSquad()->NumMembers() : 1, @@ -4892,7 +4892,7 @@ CCitizenResponseSystem *GetCitizenResponse() return g_pCitizenResponseSystem; } -char *CitizenResponseConcepts[MAX_CITIZEN_RESPONSES] = +const char *CitizenResponseConcepts[MAX_CITIZEN_RESPONSES] = { "TLK_CITIZEN_RESPONSE_SHOT_GUNSHIP", "TLK_CITIZEN_RESPONSE_KILLED_GUNSHIP", diff --git a/src/game/server/hl2/npc_citizen17.h b/src/game/server/hl2/npc_citizen17.h index 967e0a367dc..ed3f189eebd 100644 --- a/src/game/server/hl2/npc_citizen17.h +++ b/src/game/server/hl2/npc_citizen17.h @@ -211,7 +211,7 @@ class CNPC_Citizen : public CNPC_PlayerCompanion void SetSquad( CAI_Squad *pSquad ); void AddInsignia(); void RemoveInsignia(); - bool SpeakCommandResponse( AIConcept_t concept, const char *modifiers = NULL ); + bool SpeakCommandResponse( AIConcept_t aiconcept, const char *modifiers = NULL ); #ifdef MAPBASE virtual void SetPlayerAvoidState( void ); diff --git a/src/game/server/hl2/npc_combine.cpp b/src/game/server/hl2/npc_combine.cpp index c7e961db363..f39bc319634 100644 --- a/src/game/server/hl2/npc_combine.cpp +++ b/src/game/server/hl2/npc_combine.cpp @@ -3066,35 +3066,35 @@ void CNPC_Combine::SpeakSentence( int sentenceType ) #ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM //========================================================= -bool CNPC_Combine::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) +bool CNPC_Combine::SpeakIfAllowed( const char *aiconcept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) { AI_CriteriaSet set; if (modifiers) { #ifdef NEW_RESPONSE_SYSTEM - GatherCriteria( &set, concept, modifiers ); + GatherCriteria( &set, aiconcept, modifiers ); #else GetExpresser()->MergeModifiers(set, modifiers); #endif } - return SpeakIfAllowed( concept, set, sentencepriority, sentencecriteria ); + return SpeakIfAllowed( aiconcept, set, sentencepriority, sentencecriteria ); } //========================================================= //========================================================= -bool CNPC_Combine::SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) +bool CNPC_Combine::SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) { if ( sentencepriority != SENTENCE_PRIORITY_INVALID && !FOkToMakeSound( sentencepriority ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( aiconcept ) ) return false; // Don't interrupt scripted VCD dialogue if ( IsRunningScriptedSceneWithSpeechAndNotPaused( this, true ) ) return false; - if ( Speak( concept, modifiers ) ) + if ( Speak( aiconcept, modifiers ) ) { JustMadeSound( sentencepriority, 2.0f /*GetTimeSpeechComplete()*/ ); return true; diff --git a/src/game/server/hl2/npc_combine.h b/src/game/server/hl2/npc_combine.h index c19b4ba468c..e5761a5eb2b 100644 --- a/src/game/server/hl2/npc_combine.h +++ b/src/game/server/hl2/npc_combine.h @@ -202,12 +202,12 @@ class CNPC_Combine : public CAI_BaseActor // Speaking void SpeakSentence( int sentType ); #ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM - bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) + bool SpeakIfAllowed( const char *aiconcept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) { - return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); + return SpeakIfAllowed( aiconcept, NULL, sentencepriority, sentencecriteria ); } - bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); - bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *aiconcept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); #endif diff --git a/src/game/server/hl2/npc_crow.cpp b/src/game/server/hl2/npc_crow.cpp index 0b897b9ec5b..c0e3473f810 100644 --- a/src/game/server/hl2/npc_crow.cpp +++ b/src/game/server/hl2/npc_crow.cpp @@ -95,7 +95,7 @@ void CNPC_Crow::Spawn( void ) AddSpawnFlags( SF_NPC_FADE_CORPSE ); #endif // _XBOX - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/crow.mdl"; diff --git a/src/game/server/hl2/npc_eli.cpp b/src/game/server/hl2/npc_eli.cpp index c66e9273101..c1f3691fc14 100644 --- a/src/game/server/hl2/npc_eli.cpp +++ b/src/game/server/hl2/npc_eli.cpp @@ -87,7 +87,7 @@ void CNPC_Eli::Spawn() { // Eli is allowed to use multiple models, because he appears in the pod. // He defaults to his normal model. - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/eli.mdl"; diff --git a/src/game/server/hl2/npc_kleiner.cpp b/src/game/server/hl2/npc_kleiner.cpp index 4e5e5cf8ed4..79e2e75ed9d 100644 --- a/src/game/server/hl2/npc_kleiner.cpp +++ b/src/game/server/hl2/npc_kleiner.cpp @@ -84,7 +84,7 @@ int CNPC_Kleiner::GetSoundInterests ( void ) void CNPC_Kleiner::Spawn() { // Allow custom model usage (mostly for monitors) - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/kleiner.mdl"; diff --git a/src/game/server/hl2/npc_metropolice.cpp b/src/game/server/hl2/npc_metropolice.cpp index c8e13fcfd0d..4bd4c3ab41a 100644 --- a/src/game/server/hl2/npc_metropolice.cpp +++ b/src/game/server/hl2/npc_metropolice.cpp @@ -1168,31 +1168,31 @@ void CNPC_MetroPolice::SpeakSentence( int nSentenceType ) #ifdef METROPOLICE_USES_RESPONSE_SYSTEM //========================================================= //========================================================= -bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) +bool CNPC_MetroPolice::SpeakIfAllowed( const char *aiconcept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) { AI_CriteriaSet set; if (modifiers) { #ifdef NEW_RESPONSE_SYSTEM - GatherCriteria( &set, concept, modifiers ); + GatherCriteria( &set, aiconcept, modifiers ); #else GetExpresser()->MergeModifiers(set, modifiers); #endif } - return SpeakIfAllowed( concept, set, sentencepriority, sentencecriteria ); + return SpeakIfAllowed( aiconcept, set, sentencepriority, sentencecriteria ); } //========================================================= //========================================================= -bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) +bool CNPC_MetroPolice::SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) { if ( sentencepriority != SENTENCE_PRIORITY_INVALID && !FOkToMakeSound( sentencepriority ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( aiconcept ) ) return false; - if ( Speak( concept, modifiers ) ) + if ( Speak( aiconcept, modifiers ) ) { JustMadeSound( sentencepriority, 2.0f /*GetTimeSpeechComplete()*/ ); return true; diff --git a/src/game/server/hl2/npc_metropolice.h b/src/game/server/hl2/npc_metropolice.h index 690bf2ae8dd..ba2d71e6138 100644 --- a/src/game/server/hl2/npc_metropolice.h +++ b/src/game/server/hl2/npc_metropolice.h @@ -118,12 +118,12 @@ class CNPC_MetroPolice : public CAI_BaseActor // Speaking virtual void SpeakSentence( int nSentenceType ); #ifdef METROPOLICE_USES_RESPONSE_SYSTEM - bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) + bool SpeakIfAllowed( const char *aiconcept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) { - return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); + return SpeakIfAllowed( aiconcept, NULL, sentencepriority, sentencecriteria ); } - bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); - bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *aiconcept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); #endif diff --git a/src/game/server/hl2/npc_playercompanion.cpp b/src/game/server/hl2/npc_playercompanion.cpp index 088dad8ae9e..9c6b263899d 100644 --- a/src/game/server/hl2/npc_playercompanion.cpp +++ b/src/game/server/hl2/npc_playercompanion.cpp @@ -2335,7 +2335,7 @@ void CNPC_PlayerCompanion::SetAimTarget( CBaseEntity *pTarget ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CNPC_PlayerCompanion::StopAiming( char *pszReason ) +void CNPC_PlayerCompanion::StopAiming( const char *pszReason ) { #if 0 if( pszReason ) diff --git a/src/game/server/hl2/npc_playercompanion.h b/src/game/server/hl2/npc_playercompanion.h index e0f6769ef41..ebda11d01e9 100644 --- a/src/game/server/hl2/npc_playercompanion.h +++ b/src/game/server/hl2/npc_playercompanion.h @@ -255,7 +255,7 @@ class CNPC_PlayerCompanion : public CAI_PlayerAlly //--------------------------------- CBaseEntity *GetAimTarget() { return m_hAimTarget; } void SetAimTarget( CBaseEntity *pTarget ); - void StopAiming( char *pszReason = NULL ); + void StopAiming( const char *pszReason = NULL ); bool FindNewAimTarget(); void OnNewLookTarget(); bool ShouldBeAiming(); diff --git a/src/game/server/hl2/npc_scanner.cpp b/src/game/server/hl2/npc_scanner.cpp index 2c9d39f4140..ffd679d716d 100644 --- a/src/game/server/hl2/npc_scanner.cpp +++ b/src/game/server/hl2/npc_scanner.cpp @@ -530,7 +530,7 @@ void CNPC_CScanner::HandleAnimEvent( animevent_t *pEvent ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetEngineSound( void ) +const char *CNPC_CScanner::GetEngineSound( void ) { if( m_bIsClawScanner ) return "NPC_SScanner.FlyLoop"; @@ -2340,7 +2340,7 @@ void CNPC_CScanner::StartTask( const Task_t *pTask ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetScannerSoundPrefix( void ) +const char *CNPC_CScanner::GetScannerSoundPrefix( void ) { if( m_bIsClawScanner ) return "NPC_SScanner"; diff --git a/src/game/server/hl2/npc_scanner.h b/src/game/server/hl2/npc_scanner.h index 109b2a7d47b..f2d2cb8e511 100644 --- a/src/game/server/hl2/npc_scanner.h +++ b/src/game/server/hl2/npc_scanner.h @@ -48,7 +48,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Precache(void); void RunTask( const Task_t *pTask ); int SelectSchedule(void); - virtual char *GetScannerSoundPrefix( void ); + virtual const char *GetScannerSoundPrefix( void ); void Spawn(void); void Activate(); #ifdef MAPBASE @@ -80,7 +80,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Event_Killed( const CTakeDamageInfo &info ); - char *GetEngineSound( void ); + const char *GetEngineSound( void ); virtual float MinGroundDist(void); virtual void AdjustScannerVelocity( void ); diff --git a/src/game/server/hl2/npc_vortigaunt_episodic.cpp b/src/game/server/hl2/npc_vortigaunt_episodic.cpp index b41fd33afff..0a7fd086956 100644 --- a/src/game/server/hl2/npc_vortigaunt_episodic.cpp +++ b/src/game/server/hl2/npc_vortigaunt_episodic.cpp @@ -1131,7 +1131,7 @@ void CNPC_Vortigaunt::Spawn( void ) #endif // HL2_EPISODIC // Allow multiple models (for slaves), but default to vortigaunt.mdl - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/vortigaunt.mdl"; diff --git a/src/game/server/hl2/npc_zombie.cpp b/src/game/server/hl2/npc_zombie.cpp index 4699271b617..ff2cc23c3a8 100644 --- a/src/game/server/hl2/npc_zombie.cpp +++ b/src/game/server/hl2/npc_zombie.cpp @@ -1040,7 +1040,7 @@ class CZombieCustom : public CAI_ExpresserHost void Spawn( void ); void Precache( void ); - void SpeakIfAllowed( const char *concept, AI_CriteriaSet *modifiers = NULL ); + void SpeakIfAllowed( const char *aiconcept, AI_CriteriaSet *modifiers = NULL ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); virtual CAI_Expresser *CreateExpresser( void ); virtual CAI_Expresser *GetExpresser() { return m_pExpresser; } @@ -1212,9 +1212,9 @@ const char *CZombieCustom::GetMoanSound( int nSound ) #ifdef NEW_RESPONSE_SYSTEM AI_Response response; - CAI_Concept concept = "TLK_ZOMBIE_MOAN"; - concept.SetSpeaker( this ); - if (!FindResponse( response, concept, &modifiers )) + CAI_Concept aiconcept = "TLK_ZOMBIE_MOAN"; + aiconcept.SetSpeaker( this ); + if (!FindResponse( response, aiconcept, &modifiers )) return "NPC_BaseZombie.Moan1"; #else AI_Response *response = SpeakFindResponse(TLK_ZOMBIE_MOAN, modifiers); @@ -1261,10 +1261,10 @@ void CZombieCustom::AttackSound( void ) //----------------------------------------------------------------------------- // Purpose: Speak concept //----------------------------------------------------------------------------- -void CZombieCustom::SpeakIfAllowed(const char *concept, AI_CriteriaSet *modifiers) +void CZombieCustom::SpeakIfAllowed(const char *aiconcept, AI_CriteriaSet *modifiers) { AI_CriteriaSet empty; - Speak( concept, modifiers ? *modifiers : empty ); + Speak( aiconcept, modifiers ? *modifiers : empty ); } //----------------------------------------------------------------------------- diff --git a/src/game/server/hl2/prop_thumper.cpp b/src/game/server/hl2/prop_thumper.cpp index 67224ca8a65..98eec6e3224 100644 --- a/src/game/server/hl2/prop_thumper.cpp +++ b/src/game/server/hl2/prop_thumper.cpp @@ -88,7 +88,7 @@ END_DATADESC() void CPropThumper::Spawn( void ) { - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = THUMPER_MODEL_NAME; diff --git a/src/game/server/hl2/proto_sniper.cpp b/src/game/server/hl2/proto_sniper.cpp index 4cf5237bad0..6083f572a48 100644 --- a/src/game/server/hl2/proto_sniper.cpp +++ b/src/game/server/hl2/proto_sniper.cpp @@ -284,7 +284,7 @@ class CProtoSniper : public CAI_BaseNPC #ifdef EXPANDED_RESPONSE_SYSTEM_USAGE //DeclareResponseSystem() - bool SpeakIfAllowed(const char *concept, const char *modifiers = NULL); + bool SpeakIfAllowed(const char *aiconcept, const char *modifiers = NULL); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); virtual CAI_Expresser *CreateExpresser( void ); @@ -3173,12 +3173,12 @@ void CProtoSniper::NotifyShotMissedTarget() //----------------------------------------------------------------------------- // Purpose: Speak concept //----------------------------------------------------------------------------- -bool CProtoSniper::SpeakIfAllowed(const char *concept, const char *modifiers) +bool CProtoSniper::SpeakIfAllowed(const char *aiconcept, const char *modifiers) { - if (!GetExpresser()->CanSpeakConcept(concept)) + if (!GetExpresser()->CanSpeakConcept(aiconcept)) return false; - return Speak(concept, modifiers); + return Speak(aiconcept, modifiers); } //----------------------------------------------------------------------------- diff --git a/src/game/server/hltvdirector.h b/src/game/server/hltvdirector.h index 9fe60c7ae9e..24891c80cdb 100644 --- a/src/game/server/hltvdirector.h +++ b/src/game/server/hltvdirector.h @@ -67,7 +67,7 @@ class CHLTVDirector : public CGameEventListener, public CBaseGameSystemPerFrame, virtual void Shutdown(); virtual void FrameUpdatePostEntityThink(); virtual void LevelInitPostEntity(); - virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } + virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } bool SetCameraMan( int iPlayerIndex ); int GetCameraMan() { return m_iCameraManIndex; } diff --git a/src/game/server/npc_talker.cpp b/src/game/server/npc_talker.cpp index 0e0761bcbef..78d11de3d88 100644 --- a/src/game/server/npc_talker.cpp +++ b/src/game/server/npc_talker.cpp @@ -37,7 +37,7 @@ BEGIN_DATADESC( CNPCSimpleTalker ) END_DATADESC() // array of friend names -char *CNPCSimpleTalker::m_szFriends[TLK_CFRIENDS] = +const char *CNPCSimpleTalker::m_szFriends[TLK_CFRIENDS] = { "NPC_barney", "NPC_scientist", @@ -323,7 +323,7 @@ void CNPCSimpleTalker::Event_Killed( const CTakeDamageInfo &info ) CBaseEntity *CNPCSimpleTalker::EnumFriends( CBaseEntity *pPrevious, int listNumber, bool bTrace ) { CBaseEntity *pFriend = pPrevious; - char *pszFriend; + const char *pszFriend; trace_t tr; Vector vecCheck; diff --git a/src/game/server/npc_talker.h b/src/game/server/npc_talker.h index 7ea8bfe8d71..207a15c4f82 100644 --- a/src/game/server/npc_talker.h +++ b/src/game/server/npc_talker.h @@ -222,7 +222,7 @@ class CNPCSimpleTalker : public CAI_PlayerAlly int m_nSpeak; // number of times initiated talking float m_flNextIdleSpeechTime; - static char *m_szFriends[TLK_CFRIENDS]; // array of friend names + static const char *m_szFriends[TLK_CFRIENDS]; // array of friend names CBaseEntity *EnumFriends( CBaseEntity *pentPrevious, int listNumber, bool bTrace ); virtual int FriendNumber( int arrayNumber ) { return arrayNumber; } diff --git a/src/game/server/sceneentity.cpp b/src/game/server/sceneentity.cpp index ea97e57e29d..ea2b3e768df 100644 --- a/src/game/server/sceneentity.cpp +++ b/src/game/server/sceneentity.cpp @@ -2676,11 +2676,11 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata ) // Try to find the response for this slot. AI_Response response; - CAI_Concept concept(inputdata.value.String()); - concept.SetSpeaker(npc); + CAI_Concept aiconcept(inputdata.value.String()); + aiconcept.SetSpeaker(npc); AI_CriteriaSet set; - npc->GatherCriteria(&set, concept, modifiers.Get()); - bool result = npc->FindResponse( response, concept, &set); + npc->GatherCriteria(&set, aiconcept, modifiers.Get()); + bool result = npc->FindResponse( response, aiconcept, &set); if ( result ) { float duration = npc->GetResponseDuration( &response ); @@ -2688,7 +2688,7 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata ) if ( ( duration > 0.0f ) && npc->PermitResponse( duration ) ) { // If we could look it up, dispatch it and bail. - npc->SpeakDispatchResponse( concept, &response, &set); + npc->SpeakDispatchResponse( aiconcept, &response, &set); return; } } diff --git a/src/game/server/serverbenchmark_base.cpp b/src/game/server/serverbenchmark_base.cpp index dbe7269a651..6b3f5324bf1 100644 --- a/src/game/server/serverbenchmark_base.cpp +++ b/src/game/server/serverbenchmark_base.cpp @@ -391,7 +391,7 @@ class CServerBenchmark : public IServerBenchmark int m_nBotsCreated; CUtlVector< EHANDLE > m_PhysicsObjects; - CUtlVector m_PhysicsModelNames; + CUtlVector m_PhysicsModelNames; int m_nBenchmarkMode; CUniformRandomStream m_RandomStream; diff --git a/src/game/server/serverbenchmark_base.h b/src/game/server/serverbenchmark_base.h index c4cb005c312..9ca4f93a8a8 100644 --- a/src/game/server/serverbenchmark_base.h +++ b/src/game/server/serverbenchmark_base.h @@ -50,7 +50,7 @@ class CServerBenchmarkHook virtual void EndBenchmark() {} // Give a list of model names that can be spawned in for physics props during the simulation. - virtual void GetPhysicsModelNames( CUtlVector &modelNames ) = 0; + virtual void GetPhysicsModelNames( CUtlVector &modelNames ) = 0; // The benchmark will call this to create a bot each time it wants to create a player. // If you want to manage the bots yourself, you can return NULL here. diff --git a/src/game/server/skyboxswapper.cpp b/src/game/server/skyboxswapper.cpp index 40d1f2bae3a..d3114547598 100644 --- a/src/game/server/skyboxswapper.cpp +++ b/src/game/server/skyboxswapper.cpp @@ -57,7 +57,7 @@ void CSkyboxSwapper::Precache( void ) } char name[ MAX_PATH ]; - char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; + const char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; for ( int i = 0; i < 6; i++ ) { Q_snprintf( name, sizeof( name ), "skybox/%s%s", m_iszSkyboxName.ToCStr(), skyboxsuffix[i] ); diff --git a/src/game/server/textstatsmgr.cpp b/src/game/server/textstatsmgr.cpp index 602b61cdfac..55dced54829 100644 --- a/src/game/server/textstatsmgr.cpp +++ b/src/game/server/textstatsmgr.cpp @@ -58,7 +58,7 @@ char *CTextStatsMgr::GetStatsFilename( void ) return m_szStatFilename; } -void CTextStatsMgr::SetStatsFilename( char *sFilename ) +void CTextStatsMgr::SetStatsFilename( const char *sFilename ) { Assert( sFilename && sFilename[0] ); diff --git a/src/game/server/textstatsmgr.h b/src/game/server/textstatsmgr.h index 473e1a0e59a..7215139a3ee 100644 --- a/src/game/server/textstatsmgr.h +++ b/src/game/server/textstatsmgr.h @@ -34,7 +34,7 @@ class CTextStatsMgr char *GetStatsFilename( void ); // Set the filename to write stats to, if none is specified when writing - void SetStatsFilename( char *sFilename ); + void SetStatsFilename( const char *sFilename ); private: char m_szStatFilename[ MAX_PATH ]; diff --git a/src/game/server/tf/serverbenchmark_tf.cpp b/src/game/server/tf/serverbenchmark_tf.cpp index 8cd9c1f9763..19a4c7576da 100644 --- a/src/game/server/tf/serverbenchmark_tf.cpp +++ b/src/game/server/tf/serverbenchmark_tf.cpp @@ -33,7 +33,7 @@ class CTFServerBenchmark : public CServerBenchmarkHook m_bSetupLocalPlayer = false; } - virtual void GetPhysicsModelNames( CUtlVector &modelNames ) + virtual void GetPhysicsModelNames( CUtlVector &modelNames ) { modelNames.AddToTail( "models/props_farm/wooden_barrel.mdl" ); modelNames.AddToTail( "models/props_gameplay/orange_cone001.mdl" ); diff --git a/src/game/server/tf/tf_hltvdirector.cpp b/src/game/server/tf/tf_hltvdirector.cpp index adf27dc8b63..b19f66de300 100644 --- a/src/game/server/tf/tf_hltvdirector.cpp +++ b/src/game/server/tf/tf_hltvdirector.cpp @@ -37,7 +37,7 @@ class CTFHLTVDirector : public CHLTVDirector void SetHLTVServer( IHLTVServer *hltv ); void CreateShotFromEvent( CHLTVGameEvent *event ); - virtual char *GetFixedCameraEntityName( void ) { return "info_observer_point"; } + virtual const char *GetFixedCameraEntityName( void ) { return "info_observer_point"; } }; void CTFHLTVDirector::SetHLTVServer( IHLTVServer *hltv ) diff --git a/src/game/server/tf/tf_weapon_builder.cpp b/src/game/server/tf/tf_weapon_builder.cpp index 06faab8a5a7..75bbe4fb0c1 100644 --- a/src/game/server/tf/tf_weapon_builder.cpp +++ b/src/game/server/tf/tf_weapon_builder.cpp @@ -745,7 +745,7 @@ void CTFWeaponBuilder::WheatleySapperIdle( CTFPlayer *pOwner ) //Is there a sapper event? (sapper placed / sapper finished) else if( pOwner->GetSappingEvent() != TF_SAPEVENT_NONE) { - char *pVoicePakString = NULL; + const char *pVoicePakString = NULL; switch ( pOwner->GetSappingEvent() ) { case TF_SAPEVENT_PLACED: @@ -841,7 +841,7 @@ void CTFWeaponBuilder::WheatleySapperIdle( CTFPlayer *pOwner ) { bool bNoRepeats = false; bool bEmitAll = false; - char *pVoicePakString = NULL; + const char *pVoicePakString = NULL; //Sapped! vo if ( m_iSapState == TF_PSAPSTATE_WAITINGHACKED ) { diff --git a/src/game/server/util.cpp b/src/game/server/util.cpp index 2746d7ef78a..41ed697db90 100644 --- a/src/game/server/util.cpp +++ b/src/game/server/util.cpp @@ -213,7 +213,7 @@ void CEntityFactoryDictionary::UninstallFactory(const char* pClassName) m_Factories.Remove(pClassName); } -int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, char *substring, int checklen = 0 ) +int EntityFactory_AutoComplete( const char *cmdname, CUtlVector< CUtlString > &commands, CUtlRBTree< CUtlString > &symbols, const char *substring, int checklen = 0 ) { CEntityFactoryDictionary *pFactoryDict = (CEntityFactoryDictionary*)EntityFactoryDictionary(); for ( int i = pFactoryDict->m_Factories.First(); i != pFactoryDict->m_Factories.InvalidIndex(); i = pFactoryDict->m_Factories.Next( i ) ) diff --git a/src/game/server/vscript_server.cpp b/src/game/server/vscript_server.cpp index 36e0c268d00..5091374e951 100644 --- a/src/game/server/vscript_server.cpp +++ b/src/game/server/vscript_server.cpp @@ -1,4 +1,4 @@ -//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== +//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== // // Purpose: // @@ -2290,8 +2290,8 @@ static void Script_QueueSpeak( HSCRIPT hEntity, const char *pszConcept, float fl criteria.Merge( pszCriteria ); } - AIConcept_t concept( pszConcept ); - QueueSpeak( concept, pBaseEntity, flDelay, criteria ); + AIConcept_t aiconcept( pszConcept ); + QueueSpeak( aiconcept, pBaseEntity, flDelay, criteria ); } #endif @@ -2348,7 +2348,7 @@ static void ScriptSetSkyboxTexture( const char* pszSkyboxName ) } char name[ MAX_PATH ]; - char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; + const char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; for ( int i = 0; i < 6; i++ ) { Q_snprintf( name, sizeof( name ), "skybox/%s%s", pszSkyboxName, skyboxsuffix[i] ); diff --git a/src/game/shared/basecombatweapon_shared.cpp b/src/game/shared/basecombatweapon_shared.cpp index b731c671668..b0fcc644081 100644 --- a/src/game/shared/basecombatweapon_shared.cpp +++ b/src/game/shared/basecombatweapon_shared.cpp @@ -2608,7 +2608,7 @@ void CBaseCombatWeapon::AddViewKick( void ) //----------------------------------------------------------------------------- // Purpose: Get the string to print death notices with //----------------------------------------------------------------------------- -char *CBaseCombatWeapon::GetDeathNoticeName( void ) +const char *CBaseCombatWeapon::GetDeathNoticeName( void ) { #if !defined( CLIENT_DLL ) return (char*)STRING( m_iszName ); diff --git a/src/game/shared/basecombatweapon_shared.h b/src/game/shared/basecombatweapon_shared.h index 3cbf4c10faf..6b23d05604e 100644 --- a/src/game/shared/basecombatweapon_shared.h +++ b/src/game/shared/basecombatweapon_shared.h @@ -374,7 +374,7 @@ class CBaseCombatWeapon : public BASECOMBATWEAPON_DERIVED_FROM virtual void AddViewKick( void ); // Add in the view kick for the weapon - virtual char *GetDeathNoticeName( void ); // Get the string to print death notices with + virtual const char *GetDeathNoticeName( void ); // Get the string to print death notices with CBaseCombatCharacter *GetOwner() const; void SetOwner( CBaseCombatCharacter *owner ); diff --git a/src/game/shared/baseviewmodel_shared.cpp b/src/game/shared/baseviewmodel_shared.cpp index fbcbd464a40..933bec4bc53 100644 --- a/src/game/shared/baseviewmodel_shared.cpp +++ b/src/game/shared/baseviewmodel_shared.cpp @@ -140,10 +140,10 @@ void CBaseViewModel::SpawnControlPanels() // If we're attached to an entity, spawn control panels on it instead of use CBaseAnimating *pEntityToSpawnOn = this; - char *pOrgLL = "controlpanel%d_ll"; - char *pOrgUR = "controlpanel%d_ur"; - char *pAttachmentNameLL = pOrgLL; - char *pAttachmentNameUR = pOrgUR; + const char *pOrgLL = "controlpanel%d_ll"; + const char *pOrgUR = "controlpanel%d_ur"; + const char *pAttachmentNameLL = pOrgLL; + const char *pAttachmentNameUR = pOrgUR; /* if ( IsBuiltOnAttachment() ) { diff --git a/src/game/shared/hl2mp/hl2mp_gamerules.cpp b/src/game/shared/hl2mp/hl2mp_gamerules.cpp index bae7445274d..c9840e338af 100644 --- a/src/game/shared/hl2mp/hl2mp_gamerules.cpp +++ b/src/game/shared/hl2mp/hl2mp_gamerules.cpp @@ -290,7 +290,7 @@ static const char *s_PreserveEnts[] = #endif // NOTE: the indices here must match TEAM_TERRORIST, TEAM_CT, TEAM_SPECTATOR, etc. -char *sTeamNames[] = +const char *sTeamNames[] = { "Unassigned", "Spectator", diff --git a/src/game/shared/tf/tf_shareddefs.h b/src/game/shared/tf/tf_shareddefs.h index 6e90bedc4cc..7b9b7769b17 100644 --- a/src/game/shared/tf/tf_shareddefs.h +++ b/src/game/shared/tf/tf_shareddefs.h @@ -1758,46 +1758,46 @@ class CObjectInfo const char *m_pObjectName; // This stuff all comes from objects.txt - char *m_pClassName; // Code classname (in LINK_ENTITY_TO_CLASS). - char *m_pStatusName; // Shows up when crosshairs are on the object. + const char *m_pClassName; // Code classname (in LINK_ENTITY_TO_CLASS). + const char *m_pStatusName; // Shows up when crosshairs are on the object. float m_flBuildTime; int m_nMaxObjects; // Maximum number of objects per player int m_Cost; // Base object resource cost float m_CostMultiplierPerInstance; // Cost multiplier int m_UpgradeCost; // Base object resource cost for upgrading int m_MaxUpgradeLevel; // Max object upgrade level - char *m_pBuilderWeaponName; // Names shown for each object onscreen when using the builder weapon - char *m_pBuilderPlacementString; // String shown to player during placement of this object + const char *m_pBuilderWeaponName; // Names shown for each object onscreen when using the builder weapon + const char *m_pBuilderPlacementString; // String shown to player during placement of this object int m_SelectionSlot; // Weapon selection slots for objects int m_SelectionPosition; // Weapon selection positions for objects bool m_bSolidToPlayerMovement; bool m_bUseItemInfo; // Use default item appearance info. - char *m_pViewModel; // View model to show in builder weapon for this object - char *m_pPlayerModel; // World model to show attached to the player + const char *m_pViewModel; // View model to show in builder weapon for this object + const char *m_pPlayerModel; // World model to show attached to the player int m_iDisplayPriority; // Priority for ordering in the hud display ( higher is closer to top ) bool m_bVisibleInWeaponSelection; // should show up and be selectable via the weapon selection? - char *m_pExplodeSound; // gamesound to play when object explodes - char *m_pExplosionParticleEffect; // particle effect to play when object explodes + const char *m_pExplodeSound; // gamesound to play when object explodes + const char *m_pExplosionParticleEffect; // particle effect to play when object explodes bool m_bAutoSwitchTo; // should we let players switch back to the builder weapon representing this? - char *m_pUpgradeSound; // gamesound to play when object is upgraded + const char *m_pUpgradeSound; // gamesound to play when object is upgraded float m_flUpgradeDuration; // time it takes to upgrade to the next level int m_iBuildCount; // number of these that can be carried at one time int m_iNumAltModes; // whether the item has more than one mode (ex: teleporter exit/entrance) struct { - char* pszStatusName; - char* pszModeName; - char* pszIconMenu; + const char* pszStatusName; + const char* pszModeName; + const char* pszIconMenu; } m_AltModes[OBJECT_MAX_MODES]; // HUD weapon selection menu icon ( from hud_textures.txt ) - char *m_pIconActive; - char *m_pIconInactive; - char *m_pIconMenu; + const char *m_pIconActive; + const char *m_pIconInactive; + const char *m_pIconMenu; // HUD building status icon - char *m_pHudStatusIcon; + const char *m_pHudStatusIcon; // gibs int m_iMetalToDropInGibs; diff --git a/src/game/shared/tf/tf_weapon_flamethrower.cpp b/src/game/shared/tf/tf_weapon_flamethrower.cpp index 65810b22251..2cdf58e98f5 100644 --- a/src/game/shared/tf/tf_weapon_flamethrower.cpp +++ b/src/game/shared/tf/tf_weapon_flamethrower.cpp @@ -2409,7 +2409,7 @@ void CTFFlameThrower::StartFlame() } else { - char *pchFireHitSound = "Weapon_FlameThrower.FireHit"; + const char *pchFireHitSound = "Weapon_FlameThrower.FireHit"; if ( GetFlameThrowerMode() == TF_FLAMETHROWER_MODE_RAINBOW ) { diff --git a/src/game/shared/util_shared.cpp b/src/game/shared/util_shared.cpp index b348ec66bd8..f37a152a429 100644 --- a/src/game/shared/util_shared.cpp +++ b/src/game/shared/util_shared.cpp @@ -1283,7 +1283,7 @@ CBasePlayer* UTIL_PlayerByUserId( int userID ) } #ifdef CLIENT_DLL -char *UTIL_GetFilteredPlayerName( int iPlayerIndex, char *pszName ) +const char *UTIL_GetFilteredPlayerName( int iPlayerIndex, char *pszName ) { CSteamID steamIDPlayer; CBasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex ); @@ -1295,11 +1295,11 @@ char *UTIL_GetFilteredPlayerName( int iPlayerIndex, char *pszName ) } -char *UTIL_GetFilteredPlayerName( const CSteamID &steamID, char *pszName ) +const char *UTIL_GetFilteredPlayerName( const CSteamID &steamID, char *pszName ) { if ( !pszName ) { - pszName = ""; + pszName = (char*)""; } if ( SteamUtils() ) @@ -1310,7 +1310,7 @@ char *UTIL_GetFilteredPlayerName( const CSteamID &steamID, char *pszName ) } -wchar_t *UTIL_GetFilteredPlayerNameAsWChar( int iPlayerIndex, const char *pszName, wchar_t *pwszName ) +const wchar_t *UTIL_GetFilteredPlayerNameAsWChar( int iPlayerIndex, const char *pszName, wchar_t *pwszName ) { CSteamID steamIDPlayer; CBasePlayer *pPlayer = UTIL_PlayerByIndex( iPlayerIndex ); @@ -1322,7 +1322,7 @@ wchar_t *UTIL_GetFilteredPlayerNameAsWChar( int iPlayerIndex, const char *pszNam } -wchar_t *UTIL_GetFilteredPlayerNameAsWChar( const CSteamID &steamID, const char *pszName, wchar_t *pwszName ) +const wchar_t *UTIL_GetFilteredPlayerNameAsWChar( const CSteamID &steamID, const char *pszName, wchar_t *pwszName ) { if ( !pszName ) { @@ -1343,7 +1343,7 @@ wchar_t *UTIL_GetFilteredPlayerNameAsWChar( const CSteamID &steamID, const char } -char *UTIL_GetFilteredChatText( int iPlayerIndex, char *pszText, int nTextBufferSize ) +const char *UTIL_GetFilteredChatText( int iPlayerIndex, char *pszText, int nTextBufferSize ) { if ( SteamUtils() ) { @@ -1359,7 +1359,7 @@ char *UTIL_GetFilteredChatText( int iPlayerIndex, char *pszText, int nTextBuffer } #endif // CLIENT_DLL -char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename ) +const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename ) { const char *pValue = pSub->GetString( pName, NULL ); if ( !pValue ) diff --git a/src/game/shared/util_shared.h b/src/game/shared/util_shared.h index eeb1811616c..dd1ad219c84 100644 --- a/src/game/shared/util_shared.h +++ b/src/game/shared/util_shared.h @@ -387,13 +387,13 @@ CBasePlayer* UTIL_PlayerByName( const char *name ); // not case sensitive CBasePlayer* UTIL_PlayerByPartialName( const char *name ); // Get the name of a player for display, filtered for profanity and slurs -char *UTIL_GetFilteredPlayerName( int iPlayerIndex, char *pszName ); -char *UTIL_GetFilteredPlayerName( const CSteamID &steamID, char *pszName ); -wchar_t *UTIL_GetFilteredPlayerNameAsWChar( int iPlayerIndex, const char *pszName, wchar_t *pwszName ); -wchar_t *UTIL_GetFilteredPlayerNameAsWChar( const CSteamID &steamID, const char *pszName, wchar_t *pwszName ); +const char *UTIL_GetFilteredPlayerName( int iPlayerIndex, char *pszName ); +const char *UTIL_GetFilteredPlayerName( const CSteamID &steamID, char *pszName ); +const wchar_t *UTIL_GetFilteredPlayerNameAsWChar( int iPlayerIndex, const char *pszName, wchar_t *pwszName ); +const wchar_t *UTIL_GetFilteredPlayerNameAsWChar( const CSteamID &steamID, const char *pszName, wchar_t *pwszName ); // Get chat text filtered for profanity and slurs -char *UTIL_GetFilteredChatText( int iPlayerIndex, char *pszText, int nTextBufferSize ); +const char *UTIL_GetFilteredChatText( int iPlayerIndex, char *pszText, int nTextBufferSize ); // decodes a buffer using a 64bit ICE key (inplace) void UTIL_DecodeICE( unsigned char * buffer, int size, const unsigned char *key); @@ -663,7 +663,7 @@ class RealTimeCountdownTimer : public CountdownTimer } }; -char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); +const char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); int UTIL_StringFieldToInt( const char *szValue, const char **pValueStrings, int iNumStrings ); diff --git a/src/public/bitmap/imageformat.h b/src/public/bitmap/imageformat.h index 394e8bc6555..2c97c0d67e1 100644 --- a/src/public/bitmap/imageformat.h +++ b/src/public/bitmap/imageformat.h @@ -20,6 +20,7 @@ enum NormalDecodeMode_t // Forward declaration #ifdef _WIN32 +enum _D3DFORMAT : int; typedef enum _D3DFORMAT D3DFORMAT; #endif diff --git a/src/public/chunkfile.cpp b/src/public/chunkfile.cpp index 81a77dd3b12..71b3f8713c5 100644 --- a/src/public/chunkfile.cpp +++ b/src/public/chunkfile.cpp @@ -151,7 +151,7 @@ ChunkHandler_t CChunkHandlerMap::GetHandler(const char *pszChunkName, void **ppD pNode = pNode->pNext; } - return(false); + return NULL; } diff --git a/src/public/fgdlib/gamedata.h b/src/public/fgdlib/gamedata.h index 5d55db2f700..c42aed6ef02 100644 --- a/src/public/fgdlib/gamedata.h +++ b/src/public/fgdlib/gamedata.h @@ -25,7 +25,7 @@ class MDkeyvalue; class GameData; class KeyValues; -enum TEXTUREFORMAT; +enum TEXTUREFORMAT : int; typedef void (*GameDataMessageFunc_t)(int level, PRINTF_FORMAT_STRING const char *fmt, ...); diff --git a/src/public/fgdlib/gdvar.h b/src/public/fgdlib/gdvar.h index 55374de687c..940be745897 100644 --- a/src/public/fgdlib/gdvar.h +++ b/src/public/fgdlib/gdvar.h @@ -141,7 +141,7 @@ class GDinputvariable // for choices/flags: CUtlVector m_Items; - static char *m_pszEmpty; + static const char *m_pszEmpty; char m_szName[MAX_IDENT]; char m_szLongName[MAX_STRING]; diff --git a/src/public/fgdlib/inputoutput.h b/src/public/fgdlib/inputoutput.h index e8efa79a7bc..8aa2eb6afa2 100644 --- a/src/public/fgdlib/inputoutput.h +++ b/src/public/fgdlib/inputoutput.h @@ -53,7 +53,7 @@ class CClassInputOutputBase protected: - static char *g_pszEmpty; + static const char *g_pszEmpty; char m_szName[MAX_IO_NAME_LEN]; InputOutputType_t m_eType; diff --git a/src/public/fgdlib/wckeyvalues.h b/src/public/fgdlib/wckeyvalues.h index 730d92d195a..1e688c516d8 100644 --- a/src/public/fgdlib/wckeyvalues.h +++ b/src/public/fgdlib/wckeyvalues.h @@ -188,7 +188,7 @@ typedef WCKeyValuesT WCKeyValuesVector; template inline const char *WCKeyValuesT::GetKey(int nIndex) const { - return(m_KeyValues.Element(nIndex).szKey); + return(Base::m_KeyValues.Element(nIndex).szKey); } @@ -200,7 +200,7 @@ inline const char *WCKeyValuesT::GetKey(int nIndex) const template inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) { - return(m_KeyValues.Element(nIndex)); + return(Base::m_KeyValues.Element(nIndex)); } @@ -212,7 +212,7 @@ inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) template inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const { - return(m_KeyValues.Element(nIndex)); + return(Base::m_KeyValues.Element(nIndex)); } @@ -223,7 +223,7 @@ inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const template inline const char *WCKeyValuesT::GetValue(int nIndex) const { - return(m_KeyValues.Element(nIndex).szValue); + return(Base::m_KeyValues.Element(nIndex).szValue); } diff --git a/src/public/filesystem_init.cpp b/src/public/filesystem_init.cpp index 4fe72d40c44..a7aa7c470a1 100644 --- a/src/public/filesystem_init.cpp +++ b/src/public/filesystem_init.cpp @@ -417,7 +417,7 @@ void LaunchVConfig() Q_AppendSlash( vconfigExe, sizeof( vconfigExe ) ); Q_strncat( vconfigExe, "vconfig.exe", sizeof( vconfigExe ), COPY_ALL_CHARACTERS ); - char *argv[] = + const char *argv[] = { vconfigExe, "-allowdebug", diff --git a/src/public/studio.cpp b/src/public/studio.cpp index 355cc70d056..a1bad83acfe 100644 --- a/src/public/studio.cpp +++ b/src/public/studio.cpp @@ -530,7 +530,7 @@ void studiohdr_t::SetAttachmentBone( int iAttachment, int iBone ) // Purpose: //----------------------------------------------------------------------------- -char *studiohdr_t::pszNodeName( int iNode ) +const char *studiohdr_t::pszNodeName( int iNode ) { if (numincludemodels == 0) { @@ -1189,7 +1189,7 @@ void CStudioHdr::SetAttachmentBone( int iAttachment, int iBone ) // Purpose: //----------------------------------------------------------------------------- -char *CStudioHdr::pszNodeName( int iNode ) +const char *CStudioHdr::pszNodeName( int iNode ) { if (m_pVModel == NULL) { diff --git a/src/public/studio.h b/src/public/studio.h index 9480d15d95a..b73125456c0 100644 --- a/src/public/studio.h +++ b/src/public/studio.h @@ -2269,7 +2269,7 @@ struct studiohdr_t //public: int EntryNode( int iSequence ); int ExitNode( int iSequence ); - char *pszNodeName( int iNode ); + const char *pszNodeName( int iNode ); int GetTransition( int iFrom, int iTo ) const; int numflexdesc; @@ -2513,7 +2513,7 @@ class CStudioHdr int EntryNode( int iSequence ); int ExitNode( int iSequence ); - char *pszNodeName( int iNode ); + const char *pszNodeName( int iNode ); // FIXME: where should this one be? int GetTransition( int iFrom, int iTo ) const; diff --git a/src/public/tier1/utlobjectreference.h b/src/public/tier1/utlobjectreference.h index da9d30334e1..5f4520eb99c 100644 --- a/src/public/tier1/utlobjectreference.h +++ b/src/public/tier1/utlobjectreference.h @@ -97,12 +97,6 @@ template class CUtlReference return *this; } - - FORCEINLINE bool operator==( const CUtlReference& o ) const - { - return ( o.m_pObject == m_pObject ); - } - public: CUtlReference *m_pNext; CUtlReference *m_pPrev; diff --git a/src/public/tier1/utlsymbol.h b/src/public/tier1/utlsymbol.h index 802261a6905..b729b04813a 100644 --- a/src/public/tier1/utlsymbol.h +++ b/src/public/tier1/utlsymbol.h @@ -49,6 +49,7 @@ class CUtlSymbol // operator== bool operator==( CUtlSymbol const& src ) const { return m_Id == src.m_Id; } + bool operator==( UtlSymId_t const id ) const { return m_Id == id; } bool operator==( const char* pStr ) const; // Is valid? diff --git a/src/public/vgui_controls/PHandle.h b/src/public/vgui_controls/PHandle.h index 3e15889f80e..0a9a1771e24 100644 --- a/src/public/vgui_controls/PHandle.h +++ b/src/public/vgui_controls/PHandle.h @@ -34,9 +34,9 @@ class PHandle operator Panel *() const { return Get(); } Panel * operator ->() const { return Get(); } Panel * operator = (Panel *pPanel) { return Set(pPanel); } - - bool operator == (Panel *pPanel) { return (Get() == pPanel); } - operator bool () { return Get() != 0; } + + bool operator == ( const PHandle& pPanel ) const { return (Get() == pPanel.Get()); } + operator bool () const { return Get() != nullptr; } private: HPanel m_iPanelID; @@ -55,10 +55,6 @@ class VPanelHandle operator VPANEL () const { return Get(); } VPANEL operator = (VPANEL pPanel) { return Set(pPanel); } - - bool operator == (VPANEL pPanel) const { return (Get() == pPanel); } - operator bool () const { return Get() != 0; } - private: HPanel m_iPanelID; }; @@ -77,8 +73,6 @@ class DHANDLE : public PHandle operator PanelType *() const { return (PanelType *)PHandle::Get(); } PanelType * operator ->() const { return (PanelType *)PHandle::Get(); } PanelType * operator = (PanelType *pPanel) { return (PanelType *)PHandle::Set(pPanel); } - bool operator == (Panel *pPanel) const { return (PHandle::Get() == pPanel); } - operator bool () const { return PHandle::Get() != NULL; } }; }; diff --git a/src/responserules/runtime/response_system.cpp b/src/responserules/runtime/response_system.cpp index 8f41ad301e3..031282b28c9 100644 --- a/src/responserules/runtime/response_system.cpp +++ b/src/responserules/runtime/response_system.cpp @@ -2909,8 +2909,8 @@ static void CC_RR_Debug_ResponseConcept_Exclude( const CCommand &args ) { CGMsg( 0, CON_GROUP_RESPONSE_SYSTEM, "\t'%s' is not a known concept (adding it anyway)\n", args[i] ); } - CRR_Concept concept( args[i] ); - CResponseSystem::m_DebugExcludeList.AddToTail( concept ); + CRR_Concept aiconcept( args[i] ); + CResponseSystem::m_DebugExcludeList.AddToTail( aiconcept ); } } } diff --git a/src/responserules/runtime/rr_speechconcept.cpp b/src/responserules/runtime/rr_speechconcept.cpp index 7e1e04abf3a..d5563870f6d 100644 --- a/src/responserules/runtime/rr_speechconcept.cpp +++ b/src/responserules/runtime/rr_speechconcept.cpp @@ -46,7 +46,7 @@ CRR_Concept &CRR_Concept::operator=(const char *fromString) bool CRR_Concept::operator==(const char *pszConcept) { - int otherConcept = g_pRRConceptTable->Find(pszConcept); + CUtlSymbol otherConcept = g_pRRConceptTable->Find(pszConcept); return ( otherConcept != UTL_INVAL_SYMBOL && otherConcept == m_iConcept ); } diff --git a/src/utils/common/bsplib.cpp b/src/utils/common/bsplib.cpp index 607bb5ef041..368ab99569b 100644 --- a/src/utils/common/bsplib.cpp +++ b/src/utils/common/bsplib.cpp @@ -3152,7 +3152,7 @@ void SetKeyValue(entity_t *ent, const char *key, const char *value) ep->value = copystring(value); } -char *ValueForKey (entity_t *ent, char *key) +const char *ValueForKey (entity_t *ent, const char *key) { for (epair_t *ep=ent->epairs ; ep ; ep=ep->next) if (!Q_stricmp (ep->key, key) ) @@ -3160,13 +3160,13 @@ char *ValueForKey (entity_t *ent, char *key) return ""; } -vec_t FloatForKey (entity_t *ent, char *key) +vec_t FloatForKey (entity_t *ent, const char *key) { - char *k = ValueForKey (ent, key); + const char *k = ValueForKey (ent, key); return atof(k); } -vec_t FloatForKeyWithDefault (entity_t *ent, char *key, float default_value) +vec_t FloatForKeyWithDefault (entity_t *ent, const char *key, float default_value) { for (epair_t *ep=ent->epairs ; ep ; ep=ep->next) if (!Q_stricmp (ep->key, key) ) @@ -3176,24 +3176,24 @@ vec_t FloatForKeyWithDefault (entity_t *ent, char *key, float default_value) -int IntForKey (entity_t *ent, char *key) +int IntForKey (entity_t *ent, const char *key) { - char *k = ValueForKey (ent, key); + const char *k = ValueForKey (ent, key); return atol(k); } -int IntForKeyWithDefault(entity_t *ent, char *key, int nDefault ) +int IntForKeyWithDefault(entity_t *ent, const char *key, int nDefault ) { - char *k = ValueForKey (ent, key); + const char *k = ValueForKey (ent, key); if ( !k[0] ) return nDefault; return atol(k); } -void GetVectorForKey (entity_t *ent, char *key, Vector& vec) +void GetVectorForKey (entity_t *ent, const char *key, Vector& vec) { - char *k = ValueForKey (ent, key); + const char *k = ValueForKey (ent, key); // scanf into doubles, then assign, so it is vec_t size independent double v1, v2, v3; v1 = v2 = v3 = 0; @@ -3203,11 +3203,11 @@ void GetVectorForKey (entity_t *ent, char *key, Vector& vec) vec[2] = v3; } -void GetVector2DForKey (entity_t *ent, char *key, Vector2D& vec) +void GetVector2DForKey (entity_t *ent, const char *key, Vector2D& vec) { double v1, v2; - char *k = ValueForKey (ent, key); + const char *k = ValueForKey (ent, key); // scanf into doubles, then assign, so it is vec_t size independent v1 = v2 = 0; sscanf (k, "%lf %lf", &v1, &v2); @@ -3215,9 +3215,9 @@ void GetVector2DForKey (entity_t *ent, char *key, Vector2D& vec) vec[1] = v2; } -void GetAnglesForKey (entity_t *ent, char *key, QAngle& angle) +void GetAnglesForKey (entity_t *ent, const char *key, QAngle& angle) { - char *k; + const char *k; double v1, v2, v3; k = ValueForKey (ent, key); diff --git a/src/utils/common/bsplib.h b/src/utils/common/bsplib.h index 18a907f27a4..5d6f0f129bc 100644 --- a/src/utils/common/bsplib.h +++ b/src/utils/common/bsplib.h @@ -313,15 +313,15 @@ void UnparseEntities (void); void PrintEntity (entity_t *ent); void SetKeyValue (entity_t *ent, const char *key, const char *value); -char *ValueForKey (entity_t *ent, char *key); +const char *ValueForKey (entity_t *ent, const char *key); // will return "" if not present -int IntForKey (entity_t *ent, char *key); -int IntForKeyWithDefault(entity_t *ent, char *key, int nDefault ); -vec_t FloatForKey (entity_t *ent, char *key); -vec_t FloatForKeyWithDefault (entity_t *ent, char *key, float default_value); -void GetVectorForKey (entity_t *ent, char *key, Vector& vec); -void GetVector2DForKey (entity_t *ent, char *key, Vector2D& vec); -void GetAnglesForKey (entity_t *ent, char *key, QAngle& vec); +int IntForKey (entity_t *ent, const char *key); +int IntForKeyWithDefault(entity_t *ent, const char *key, int nDefault ); +vec_t FloatForKey (entity_t *ent, const char *key); +vec_t FloatForKeyWithDefault (entity_t *ent, const char *key, float default_value); +void GetVectorForKey (entity_t *ent, const char *key, Vector& vec); +void GetVector2DForKey (entity_t *ent, const char *key, Vector2D& vec); +void GetAnglesForKey (entity_t *ent, const char *key, QAngle& vec); epair_t *ParseEpair (void); void StripTrailing (char *e); diff --git a/src/utils/motionmapper/motionmapper.cpp b/src/utils/motionmapper/motionmapper.cpp index 731b1139cb5..dce28e42568 100644 --- a/src/utils/motionmapper/motionmapper.cpp +++ b/src/utils/motionmapper/motionmapper.cpp @@ -2164,7 +2164,7 @@ void split(char *str, char *sep, char **sp) } -int checkCommand(char *str, char *cmd, int numOptions, int numSplit) +int checkCommand(const char *str, const char *cmd, int numOptions, int numSplit) { if(strcmp(str, cmd) == 0) { diff --git a/src/utils/serverplugin_sample/serverplugin_empty.cpp b/src/utils/serverplugin_sample/serverplugin_empty.cpp index 42e4c1d3bfc..3fd5d4eb526 100644 --- a/src/utils/serverplugin_sample/serverplugin_empty.cpp +++ b/src/utils/serverplugin_sample/serverplugin_empty.cpp @@ -281,7 +281,7 @@ void CEmptyServerPlugin::SetCommandClient( int index ) m_iClientCommandIndex = index; } -void ClientPrint( edict_t *pEdict, char *format, ... ) +void ClientPrint( edict_t *pEdict, const char *format, ... ) { va_list argptr; static char string[1024]; diff --git a/src/utils/vbsp/cubemap.cpp b/src/utils/vbsp/cubemap.cpp index 9b5f46415f5..d3e11cef07c 100644 --- a/src/utils/vbsp/cubemap.cpp +++ b/src/utils/vbsp/cubemap.cpp @@ -85,8 +85,8 @@ inline bool SideHasCubemapAndWasntManuallyReferenced( int iSide ) } #ifdef PARALLAX_CORRECTED_CUBEMAPS -char* g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES]; -void Cubemap_InsertSample( const Vector& origin, int size, char* pParallaxObbStr = "" ) +const char* g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES]; +void Cubemap_InsertSample( const Vector& origin, int size, const char* pParallaxObbStr = "" ) { g_pParallaxObbStrs[g_nCubemapSamples] = pParallaxObbStr; #else @@ -105,7 +105,7 @@ static const char *FindSkyboxMaterialName( void ) { for( int i = 0; i < g_MainMap->num_entities; i++ ) { - char* pEntity = ValueForKey(&g_MainMap->entities[i], "classname"); + const char* pEntity = ValueForKey(&g_MainMap->entities[i], "classname"); if (!strcmp(pEntity, "worldspawn")) { return ValueForKey( &g_MainMap->entities[i], "skyname" ); diff --git a/src/utils/vbsp/detailobjects.cpp b/src/utils/vbsp/detailobjects.cpp index c6c1fc2becf..90d5842c314 100644 --- a/src/utils/vbsp/detailobjects.cpp +++ b/src/utils/vbsp/detailobjects.cpp @@ -285,7 +285,7 @@ static const char *FindDetailVBSPName( void ) { for( int i = 0; i < num_entities; i++ ) { - char* pEntity = ValueForKey( &entities[i], "classname" ); + const char* pEntity = ValueForKey( &entities[i], "classname" ); if ( !strcmp( pEntity, "worldspawn" ) ) { const char *pDetailVBSP = ValueForKey( &entities[i], "detailvbsp" ); @@ -904,12 +904,12 @@ void EmitDetailModels() Vector2D tex[2]; for (int i = 0; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if (!strcmp(pEntity, "detail_prop") || !strcmp(pEntity, "prop_detail")) { GetVectorForKey( &entities[i], "origin", origin ); GetAnglesForKey( &entities[i], "angles", angles ); - char* pModelName = ValueForKey( &entities[i], "model" ); + const char* pModelName = ValueForKey( &entities[i], "model" ); int nOrientation = IntForKey( &entities[i], "detailOrientation" ); AddDetailToLump( pModelName, origin, angles, nOrientation ); diff --git a/src/utils/vbsp/disp_vbsp.cpp b/src/utils/vbsp/disp_vbsp.cpp index 8802160f28d..680d295ed86 100644 --- a/src/utils/vbsp/disp_vbsp.cpp +++ b/src/utils/vbsp/disp_vbsp.cpp @@ -627,7 +627,7 @@ void DispGetFaceInfo( mapbrush_t *pBrush ) // we don't support displacement on entities at the moment!! if( pBrush->entitynum != 0 ) { - char* pszEntityName = ValueForKey( &g_LoadingMap->entities[pBrush->entitynum], "classname" ); + const char* pszEntityName = ValueForKey( &g_LoadingMap->entities[pBrush->entitynum], "classname" ); Error( "Error: displacement found on a(n) %s entity - not supported (entity %d, brush %d)\n", pszEntityName, pBrush->entitynum, pBrush->brushnum ); } diff --git a/src/utils/vbsp/manifest.cpp b/src/utils/vbsp/manifest.cpp index caa71445d53..b03959c7f29 100644 --- a/src/utils/vbsp/manifest.cpp +++ b/src/utils/vbsp/manifest.cpp @@ -365,7 +365,7 @@ ChunkFileResult_t CManifest::LoadPrefsMapsCallback( CChunkFile *pFile, CManifest // pValue - the value of the pair // Output : returns a newly created epair structure //----------------------------------------------------------------------------- -epair_t *CManifest::CreateEPair( char *pKey, char *pValue ) +epair_t *CManifest::CreateEPair( const char *pKey, const char *pValue ) { epair_t *pEPair = new epair_t; diff --git a/src/utils/vbsp/manifest.h b/src/utils/vbsp/manifest.h index 3d772117759..5de27b81361 100644 --- a/src/utils/vbsp/manifest.h +++ b/src/utils/vbsp/manifest.h @@ -67,7 +67,7 @@ class CManifest static ChunkFileResult_t LoadPrefsMapsCallback( CChunkFile *pFile, CManifest *pManifest ); bool LoadSubMaps( CMapFile *pMapFile, const char *pszFileName ); - epair_t *CreateEPair( char *pKey, char *pValue ); + epair_t *CreateEPair( const char *pKey, const char *pValue ); bool LoadVMFManifest( const char *pszFileName ); const char *GetInstancePath( ) { return m_InstancePath; } diff --git a/src/utils/vbsp/map.cpp b/src/utils/vbsp/map.cpp index 30eea89bcea..73a6012c5bb 100644 --- a/src/utils/vbsp/map.cpp +++ b/src/utils/vbsp/map.cpp @@ -1260,9 +1260,9 @@ int CMapFile::SideIDToIndex( int brushSideID ) // Input : *mapent - // *key - //----------------------------------------------------------------------------- -void ConvertSideList( entity_t *mapent, char *key ) +void ConvertSideList( entity_t *mapent, const char *key ) { - char *pszSideList = ValueForKey( mapent, key ); + const char *pszSideList = ValueForKey( mapent, key ); if (pszSideList) { @@ -1310,10 +1310,11 @@ void ConvertSideList( entity_t *mapent, char *key ) ChunkFileResult_t HandleNoDynamicShadowsEnt( entity_t *pMapEnt ) { // Get the list of the sides. - char *pSideList = ValueForKey( pMapEnt, "sides" ); + const char *pSideList = ValueForKey( pMapEnt, "sides" ); // Parse the side list. - char *pScan = strtok( pSideList, " " ); + // Yes the const_cast sucks.. strtok won't do anything for an empty string literal + char *pScan = strtok( const_cast(pSideList), " " ); if( pScan ) { do @@ -1644,7 +1645,7 @@ ChunkFileResult_t CMapFile::LoadEntityCallback(CChunkFile *pFile, int nParam) { const char *pSideListStr = ValueForKey( mapent, "sides" ); #ifdef PARALLAX_CORRECTED_CUBEMAPS - char *pParallaxObbStr = ValueForKey( mapent, "parallaxobb" ); + const char *pParallaxObbStr = ValueForKey( mapent, "parallaxobb" ); #endif int size; size = IntForKey( mapent, "cubemapsize" ); @@ -1925,7 +1926,7 @@ void CMapFile::ForceFuncAreaPortalWindowContents() { // Now go through all areaportal entities and force CONTENTS_WINDOW // on the brushes of the bmodels they point at. - char *targets[] = {"target", "BackgroundBModel"}; + const char *targets[] = {"target", "BackgroundBModel"}; int nTargets = sizeof(targets) / sizeof(targets[0]); for( int i=0; i < num_entities; i++ ) @@ -2139,10 +2140,10 @@ void CMapFile::CheckForInstances( const char *pszFileName ) // automatically done in this processing. for ( int i = 0; i < num_entities; i++ ) { - char *pEntity = ValueForKey( &entities[ i ], "classname" ); + const char *pEntity = ValueForKey( &entities[ i ], "classname" ); if ( !strcmp( pEntity, "func_instance" ) ) { - char *pInstanceFile = ValueForKey( &entities[ i ], "file" ); + const char *pInstanceFile = ValueForKey( &entities[ i ], "file" ); if ( pInstanceFile[ 0 ] ) @@ -2468,8 +2469,8 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec int max_ai_node_id = 0; #endif - char *pTargetName = ValueForKey( pInstanceEntity, "targetname" ); - char *pName = ValueForKey( pInstanceEntity, "name" ); + const char *pTargetName = ValueForKey( pInstanceEntity, "targetname" ); + const char *pName = ValueForKey( pInstanceEntity, "name" ); if ( pTargetName[ 0 ] ) { sprintf( NameFixup, "%s", pTargetName ); @@ -2485,7 +2486,7 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec for( int i = 0; i < num_entities; i++ ) { - char *pID = ValueForKey( &entities[ i ], "hammerid" ); + const char *pID = ValueForKey( &entities[ i ], "hammerid" ); if ( pID[ 0 ] ) { int value = atoi( pID ); @@ -2521,7 +2522,7 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec entity->firstbrush += ( nummapbrushes - Instance->nummapbrushes ); } - char *pID = ValueForKey( entity, "hammerid" ); + const char *pID = ValueForKey( entity, "hammerid" ); if ( pID[ 0 ] ) { int value = atoi( pID ); @@ -2531,7 +2532,7 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec SetKeyValue( entity, "hammerid", temp ); } - char *pEntity = ValueForKey( entity, "classname" ); + const char *pEntity = ValueForKey( entity, "classname" ); if ( strcmpi( pEntity, "worldspawn" ) == 0 ) { WorldspawnEnt = entity; @@ -2562,7 +2563,7 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec for( int j = 0; j < EntClass->GetVariableCount(); j++ ) { GDinputvariable *EntVar = EntClass->GetVariableAt( j ); - char *pValue = ValueForKey( entity, ( char * )EntVar->GetName() ); + const char *pValue = ValueForKey( entity, ( char * )EntVar->GetName() ); if ( GD.RemapKeyValue( EntVar->GetName(), pValue, temp, FixupStyle ) ) { #ifdef MERGE_INSTANCE_DEBUG_INFO @@ -2624,10 +2625,10 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec } // If the parent instance is within a relative path and no file relative to the main map exists, change it to be relative to the parent - char *pParentInstanceFile = ValueForKey( pInstanceEntity, "file" ); + const char *pParentInstanceFile = ValueForKey( pInstanceEntity, "file" ); if ( pParentInstanceFile[ 0 ] && (strchr( pParentInstanceFile, '\\' ) || strchr( pParentInstanceFile, '/' )) ) { - char *pInstanceFile = ValueForKey( entity, "file" ); + const char *pInstanceFile = ValueForKey( entity, "file" ); if ( pInstanceFile[ 0 ] ) { char InstancePath[ MAX_PATH ]; @@ -2709,7 +2710,7 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec MoveBrushesToWorldGeneral( WorldspawnEnt ); WorldspawnEnt->numbrushes = 0; #ifdef MAPBASE - char *pIsTopLevel = ValueForKey( pInstanceEntity, "toplevel" ); + const char *pIsTopLevel = ValueForKey( pInstanceEntity, "toplevel" ); if ( strcmp( pIsTopLevel, "1" ) == 0 ) { g_ManifestWorldSpawn->epairs = WorldspawnEnt->epairs; @@ -3561,7 +3562,7 @@ void CMapFile::TestExpandBrushes (void) side_t *s; int i, j, bn; winding_t *w; - char *name = "expanded.map"; + const char *name = "expanded.map"; mapbrush_t *brush; vec_t dist; diff --git a/src/utils/vbsp/portals.cpp b/src/utils/vbsp/portals.cpp index bbd3312ea73..c33beaf7776 100644 --- a/src/utils/vbsp/portals.cpp +++ b/src/utils/vbsp/portals.cpp @@ -745,7 +745,7 @@ qboolean FloodEntities (tree_t *tree) { int i; Vector origin; - char *cl; + const char *cl; qboolean inside; node_t *headnode; diff --git a/src/utils/vbsp/staticprop.cpp b/src/utils/vbsp/staticprop.cpp index ecef50110c6..9d173b2aa66 100644 --- a/src/utils/vbsp/staticprop.cpp +++ b/src/utils/vbsp/staticprop.cpp @@ -587,7 +587,7 @@ void EmitStaticProps() int i; for ( i = 0; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if (!Q_strcmp(pEntity, "info_lighting")) { s_LightingInfo.AddToTail(i); @@ -597,7 +597,7 @@ void EmitStaticProps() // Emit specifically specified static props for ( i = 0; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); #ifdef MAPBASE const int iInsertAsStatic = IntForKey( &entities[i], "insertasstaticprop" ); // If the key is absent, IntForKey will return 0. bool bInsertAsStatic = g_bPropperInsertAllAsStatic; @@ -618,7 +618,7 @@ void EmitStaticProps() #ifdef MAPBASE if ( !strcmp( pEntity, "propper_model" ) ) { - char* pModelName = ValueForKey( &entities[i], "modelname" ); + const char* pModelName = ValueForKey( &entities[i], "modelname" ); // The modelname keyvalue lacks 'models/' at the start and '.mdl' at the end, so we have to add them. char modelpath[MAX_VALUE]; diff --git a/src/utils/vbsp/vbsp.cpp b/src/utils/vbsp/vbsp.cpp index 5035529846a..6e41c687f99 100644 --- a/src/utils/vbsp/vbsp.cpp +++ b/src/utils/vbsp/vbsp.cpp @@ -834,7 +834,7 @@ static void Compute3DSkyboxAreas( node_t *headnode, CUtlVector& areas ) { for (int i = 0; i < g_MainMap->num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if (!strcmp(pEntity, "sky_camera")) { // Found a 3D skybox camera, get a leaf that lies in it @@ -1515,7 +1515,7 @@ int RunVBSP( int argc, char **argv ) g_nCubemapSamples = 0; // Mark as stale since the lighting could be screwed with new ents. - AddBufferToPak( GetPakFile(), "stale.txt", "stale", strlen( "stale" ) + 1, false ); + AddBufferToPak( GetPakFile(), "stale.txt", const_cast("stale"), strlen("stale") + 1, false); LoadMapFile (name); SetModelNumbers (); @@ -1572,7 +1572,7 @@ int RunVBSP( int argc, char **argv ) { LoadBSPFile_FileSystemOnly (mapFile); // Mark as stale since the lighting could be screwed with new ents. - AddBufferToPak( GetPakFile(), "stale.txt", "stale", strlen( "stale" ) + 1, false ); + AddBufferToPak( GetPakFile(), "stale.txt", const_cast("stale"), strlen( "stale" ) + 1, false ); } LoadMapFile (name); diff --git a/src/utils/vbsp/vbsp.h b/src/utils/vbsp/vbsp.h index 1366392f067..e99c226bad0 100644 --- a/src/utils/vbsp/vbsp.h +++ b/src/utils/vbsp/vbsp.h @@ -650,8 +650,8 @@ void SaveVertexNormals( void ); //============================================================================= // cubemap.cpp #ifdef PARALLAX_CORRECTED_CUBEMAPS -extern char* g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES]; -void Cubemap_InsertSample( const Vector& origin, int size, char* pParallaxObbStr ); +extern const char* g_pParallaxObbStrs[MAX_MAP_CUBEMAPSAMPLES]; +void Cubemap_InsertSample( const Vector& origin, int size, const char* pParallaxObbStr ); #else void Cubemap_InsertSample( const Vector& origin, int size ); #endif diff --git a/src/utils/vbsp/vscript_funcs_vmfs.cpp b/src/utils/vbsp/vscript_funcs_vmfs.cpp index 57b22898dc0..3e531a31b3e 100644 --- a/src/utils/vbsp/vscript_funcs_vmfs.cpp +++ b/src/utils/vbsp/vscript_funcs_vmfs.cpp @@ -111,11 +111,11 @@ static HSCRIPT VMFKV_AddEntityFromTables( HSCRIPT hVMF, HSCRIPT hKV, HSCRIPT hIO { KeyValues *pVMF = scriptmanager->GetKeyValuesFromScriptKV( g_pScriptVM, hVMF ); if (!pVMF) - return false; + return NULL; KeyValues *pEnt = pVMF->CreateNewKey(); if (!pEnt) - return false; + return NULL; pEnt->SetName( "entity" ); diff --git a/src/utils/vbsp/writebsp.cpp b/src/utils/vbsp/writebsp.cpp index c3bc09d6d69..f6c4b0fa04d 100644 --- a/src/utils/vbsp/writebsp.cpp +++ b/src/utils/vbsp/writebsp.cpp @@ -985,7 +985,7 @@ SetLightStyles void SetLightStyles (void) { int stylenum; - char *t; + const char *t; entity_t *e; int i, j; char value[10]; @@ -1024,7 +1024,7 @@ void SetLightStyles (void) stylenum++; } sprintf (value, "%i", 32 + j); - char *pCurrentStyle = ValueForKey( e, "style" ); + const char *pCurrentStyle = ValueForKey( e, "style" ); // the designer has set a default lightstyle as well as making the light switchable if ( pCurrentStyle ) { @@ -1543,7 +1543,7 @@ void ComputeBoundsNoSkybox( ) // Add the bounds to the worldspawn data for (int i = 0; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if (!strcmp(pEntity, "worldspawn")) { char string[32]; diff --git a/src/utils/vrad/lightmap.cpp b/src/utils/vrad/lightmap.cpp index 0aaea29f418..e93167125a7 100644 --- a/src/utils/vrad/lightmap.cpp +++ b/src/utils/vrad/lightmap.cpp @@ -938,10 +938,10 @@ int numdlights; FindTargetEntity ================== */ -entity_t *FindTargetEntity (char *target) +entity_t *FindTargetEntity (const char *target) { int i; - char *n; + const char *n; for (i=0 ; ilight.style = (int)FloatForKey (e, "style"); @@ -1462,7 +1462,7 @@ void BuildVisForLightEnvironment( void ) } } -static char *ValueForKeyWithDefault (entity_t *ent, char *key, char *default_value = NULL) +static const char *ValueForKeyWithDefault (entity_t *ent, const char *key, const char *default_value = NULL) { epair_t *ep; @@ -1480,7 +1480,7 @@ static void ParseLightEnvironment( entity_t* e, directlight_t* dl ) ParseLightGeneric( e, dl ); - char *angle_str=ValueForKeyWithDefault( e, "SunSpreadAngle" ); + const char *angle_str=ValueForKeyWithDefault( e, "SunSpreadAngle" ); if (angle_str) { g_SunAngularExtent=atof(angle_str); @@ -1544,7 +1544,7 @@ void CreateDirectLights (void) CPatch *p = NULL; directlight_t *dl = NULL; entity_t *e = NULL; - char *name; + const char *name; Vector dest; numdlights = 0; diff --git a/src/utils/vrad/macro_texture.cpp b/src/utils/vrad/macro_texture.cpp index cd0eac12336..c1a300aa231 100644 --- a/src/utils/vrad/macro_texture.cpp +++ b/src/utils/vrad/macro_texture.cpp @@ -86,7 +86,7 @@ void InitMacroTexture( const char *pBSPFilename ) int i = 0; for (i; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if( !strcmp(pEntity, "worldspawn") ) { GetVectorForKey( &entities[i], "world_mins", g_MacroWorldMins ); diff --git a/src/utils/vrad/vrad.cpp b/src/utils/vrad/vrad.cpp index 7dea037a539..33051630884 100644 --- a/src/utils/vrad/vrad.cpp +++ b/src/utils/vrad/vrad.cpp @@ -667,7 +667,7 @@ void MakePatchForFace (int fn, winding_t *w) entity_t *EntityForModel (int modnum) { int i; - char *s; + const char *s; char name[16]; sprintf (name, "*%i", modnum); @@ -1306,7 +1306,7 @@ void WriteWorld (char *name, int iBump) g_pFileSystem->Close( out ); } -void WriteRTEnv (char *name) +void WriteRTEnv (const char *name) { FileHandle_t out; diff --git a/src/utils/vrad/vrad.h b/src/utils/vrad/vrad.h index e741ee6b4de..2fefd434a5d 100644 --- a/src/utils/vrad/vrad.h +++ b/src/utils/vrad/vrad.h @@ -397,7 +397,7 @@ void AddBrushesForRayTrace ( void ); void BaseLightForFace( dface_t *f, Vector& light, float *parea, Vector& reflectivity ); void CreateDirectLights (void); void GetPhongNormal( int facenum, Vector const& spot, Vector& phongnormal ); -int LightForString( char *pLight, Vector& intensity ); +int LightForString( const char *pLight, Vector& intensity ); void MakeTransfer( int ndxPatch1, int ndxPatch2, transfer_t *all_transfers ); void MakeScales( int ndxPatch, transfer_t *all_transfers ); diff --git a/src/utils/vrad/vraddetailprops.cpp b/src/utils/vrad/vraddetailprops.cpp index 168709f0cb1..a66e8f4c746 100644 --- a/src/utils/vrad/vraddetailprops.cpp +++ b/src/utils/vrad/vraddetailprops.cpp @@ -524,7 +524,8 @@ class CLightSurface : public IBSPNodeEnumerator bool TestPointAgainstSkySurface( Vector const &pt, dface_t *pFace ) { // Create sky face winding. - winding_t *pWinding = WindingFromFace( pFace, Vector( 0.0f, 0.0f, 0.0f ) ); + Vector skyOrigin( 0.0f, 0.0f, 0.0f ); + winding_t *pWinding = WindingFromFace( pFace, skyOrigin ); // Test point in winding. (Since it is at the node, it is in the plane.) bool bRet = PointInWinding( pt, pWinding ); diff --git a/src/utils/vrad/vraddll.cpp b/src/utils/vrad/vraddll.cpp index bc9f2f457aa..031fb7c9ea4 100644 --- a/src/utils/vrad/vraddll.cpp +++ b/src/utils/vrad/vraddll.cpp @@ -33,7 +33,7 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CVRadDLL, ILaunchableDLL, LAUNCHABLE_DLL_INTE class dat { public: - char *name; + const char *name; int size; }; #define DATENTRY(name) {#name, sizeof(name)} diff --git a/src/utils/vtfdiff/vtfdiff.cpp b/src/utils/vtfdiff/vtfdiff.cpp index fa7b09088f0..54c9df8db39 100644 --- a/src/utils/vtfdiff/vtfdiff.cpp +++ b/src/utils/vtfdiff/vtfdiff.cpp @@ -23,6 +23,7 @@ void Usage( void ) bool LoadFileIntoBuffer( const char *pFileName, CUtlBuffer &buf ) { + int nBytesRead; struct _stat statBuf; if( _stat( pFileName, &statBuf ) != 0 ) { @@ -37,7 +38,7 @@ bool LoadFileIntoBuffer( const char *pFileName, CUtlBuffer &buf ) goto error; } - int nBytesRead = fread( buf.Base(), 1, statBuf.st_size, fp ); + nBytesRead = fread( buf.Base(), 1, statBuf.st_size, fp ); fclose( fp ); buf.SeekPut( CUtlBuffer::SEEK_HEAD, nBytesRead ); diff --git a/src/utils/vvis/vvis.cpp b/src/utils/vvis/vvis.cpp index 9591242ee7b..60835674fe7 100644 --- a/src/utils/vvis/vvis.cpp +++ b/src/utils/vvis/vvis.cpp @@ -890,7 +890,7 @@ float DetermineVisRadius( ) // Check the max vis range to determine the vis radius for (int i = 0; i < num_entities; ++i) { - char* pEntity = ValueForKey(&entities[i], "classname"); + const char* pEntity = ValueForKey(&entities[i], "classname"); if (!stricmp(pEntity, "env_fog_controller")) { flRadius = FloatForKey (&entities[i], "farz"); diff --git a/src/vgui2/matsys_controls/baseassetpicker.cpp b/src/vgui2/matsys_controls/baseassetpicker.cpp index 30144f2b3b1..c01d25b6bcf 100644 --- a/src/vgui2/matsys_controls/baseassetpicker.cpp +++ b/src/vgui2/matsys_controls/baseassetpicker.cpp @@ -964,7 +964,7 @@ void CBaseAssetPicker::GetUserConfigSettings( KeyValues *pUserConfig ) pUserConfig->SetString( "filter", m_Filter ); pUserConfig->SetString( "folderfilter", m_FolderFilter ); pUserConfig->SetString( "mod", ( m_nCurrentModFilter >= 0 ) ? - s_AssetCache.ModInfo( m_nCurrentModFilter ).m_ModName : "" ); + s_AssetCache.ModInfo( m_nCurrentModFilter ).m_ModName.Get() : ""); } diff --git a/src/vgui2/matsys_controls/mdlpicker.cpp b/src/vgui2/matsys_controls/mdlpicker.cpp index 17c5b562d04..00e6524eeda 100644 --- a/src/vgui2/matsys_controls/mdlpicker.cpp +++ b/src/vgui2/matsys_controls/mdlpicker.cpp @@ -929,7 +929,7 @@ void CMDLPicker::GenerateBackpackIcons( void ) Q_FixSlashes( pOutputPathGame ); // run vtex on the TGA and .txt file to create .VTF and add it to our Perforce changelist - char *vTexArgv[64]; + const char *vTexArgv[64]; int vTexArgc = 0; vTexArgv[ vTexArgc++ ] = ""; vTexArgv[ vTexArgc++ ] = "-quiet"; @@ -940,7 +940,7 @@ void CMDLPicker::GenerateBackpackIcons( void ) vTexArgv[ vTexArgc++ ] = pOutputPathGame; vTexArgv[ vTexArgc++ ] = (char *)pLargeTGAName; - g_pVTex->VTex( MdlPickerFSFactory, pOutputPathGame, vTexArgc, vTexArgv ); + g_pVTex->VTex( MdlPickerFSFactory, pOutputPathGame, vTexArgc, const_cast(vTexArgv) ); // Generale small TGA name, by removing the "large" part char pSmallTGAName[ MAX_PATH ]; @@ -1036,7 +1036,7 @@ void CMDLPicker::GenerateBackpackIcons( void ) vTexArgv[ vTexArgc++ ] = "-outdir"; vTexArgv[ vTexArgc++ ] = pOutputPathGame; vTexArgv[ vTexArgc++ ] = (char *)pSmallTGAName; - g_pVTex->VTex( MdlPickerFSFactory, pOutputPathGame, vTexArgc, vTexArgv ); + g_pVTex->VTex( MdlPickerFSFactory, pOutputPathGame, vTexArgc, const_cast(vTexArgv) ); // restore the preview panel to its original state