diff --git a/sp/src/game/server/ai_basenpc.cpp b/sp/src/game/server/ai_basenpc.cpp index 2149a19d..ea1b71d5 100644 --- a/sp/src/game/server/ai_basenpc.cpp +++ b/sp/src/game/server/ai_basenpc.cpp @@ -14674,7 +14674,12 @@ void CAI_BaseNPC::CalculateValidEnemyInteractions( void ) // If we have a damage filter that prevents us hurting the enemy, // don't interact with him, since most interactions kill the enemy. // Create a fake damage info to test it with. +#ifdef MAPBASE + // DMG_PREVENT_PHYSICS_FORCE can be used to identify dynamic interaction tests + CTakeDamageInfo tempinfo( this, this, vec3_origin, vec3_origin, 1.0, DMG_BULLET | DMG_PREVENT_PHYSICS_FORCE ); +#else CTakeDamageInfo tempinfo( this, this, vec3_origin, vec3_origin, 1.0, DMG_BULLET ); +#endif if ( !pNPC->PassesDamageFilter( tempinfo ) ) continue; diff --git a/sp/src/game/server/baseentity.cpp b/sp/src/game/server/baseentity.cpp index fa8843fc..5f371eee 100644 --- a/sp/src/game/server/baseentity.cpp +++ b/sp/src/game/server/baseentity.cpp @@ -8012,10 +8012,31 @@ void CBaseEntity::DispatchResponse( const char *conceptName ) #ifdef MAPBASE if (response[0] == '$') { - response[0] = '\0'; - DevMsg("Replacing %s with %s...\n", response, GetContextValue(response)); - Q_strncpy(response, GetContextValue(response), sizeof(response)); - PrecacheScriptSound( response ); + const char *context = response + 1; + const char *replace = GetContextValue(context); + + if (replace) + { + DevMsg("Replacing %s with %s...\n", response, replace); + Q_strncpy(response, replace, sizeof(response)); + + // Precache it now because it may not have been precached before + switch ( result.GetType() ) + { + case RESPONSE_SPEAK: + { + PrecacheScriptSound( response ); + } + break; + + case RESPONSE_SCENE: + { + // TODO: Gender handling? + PrecacheInstancedScene( response ); + } + break; + } + } } #endif switch ( result.GetType() ) diff --git a/sp/src/game/server/hl2/npc_combine.cpp b/sp/src/game/server/hl2/npc_combine.cpp index 64ae37dd..84ee9fa7 100644 --- a/sp/src/game/server/hl2/npc_combine.cpp +++ b/sp/src/game/server/hl2/npc_combine.cpp @@ -42,7 +42,7 @@ int g_fCombineQuestion; // true if an idle grunt asked a question. Cleared wh #ifdef MAPBASE ConVar npc_combine_idle_walk_easy("npc_combine_idle_walk_easy", "1"); ConVar npc_combine_unarmed_anims("npc_combine_unarmed_anims", "1"); -ConVar npc_combine_altfire_alliesonly("npc_combine_altfire_alliesonly", "0"); +ConVar npc_combine_altfire_not_allies_only( "npc_combine_altfire_not_allies_only", "1" ); #endif #define COMBINE_SKIN_DEFAULT 0 @@ -3362,7 +3362,7 @@ bool CNPC_Combine::CanAltFireEnemy( bool bUseFreeKnowledge ) // "Our weapons alone cannot take down the antlion guard!" // "Wait, you're an elite, don't you have, like, disintegration balls or somethi--" // "SHUT UP!" - if ( npc_combine_altfire_alliesonly.GetBool() && !pEnemy->IsPlayer() && (!pEnemy->IsNPC() || !pEnemy->MyNPCPointer()->IsPlayerAlly()) ) + if ( !npc_combine_altfire_not_allies_only.GetBool() && !pEnemy->IsPlayer() && (!pEnemy->IsNPC() || !pEnemy->MyNPCPointer()->IsPlayerAlly()) ) #else if( !pEnemy->IsPlayer() && (!pEnemy->IsNPC() || !pEnemy->MyNPCPointer()->IsPlayerAlly()) ) #endif diff --git a/sp/src/game/server/hl2/npc_playercompanion.cpp b/sp/src/game/server/hl2/npc_playercompanion.cpp index 981f5692..b8a5725d 100644 --- a/sp/src/game/server/hl2/npc_playercompanion.cpp +++ b/sp/src/game/server/hl2/npc_playercompanion.cpp @@ -160,7 +160,6 @@ bool CNPC_PlayerCompanion::gm_bFindingCoverFromAllEnemies; #ifdef MAPBASE string_t CNPC_PlayerCompanion::gm_iszMortarClassname; string_t CNPC_PlayerCompanion::gm_iszGroundTurretClassname; -string_t CNPC_PlayerCompanion::gm_iszRollerMineClassname; #else string_t CNPC_PlayerCompanion::gm_iszMortarClassname; string_t CNPC_PlayerCompanion::gm_iszFloorTurretClassname; @@ -206,9 +205,8 @@ bool CNPC_PlayerCompanion::CreateBehaviors() void CNPC_PlayerCompanion::Precache() { #ifdef MAPBASE - SetGlobalString(gm_iszMortarClassname, "func_tankmortar"); - SetGlobalString(gm_iszGroundTurretClassname, "npc_turret_ground"); - SetGlobalString(gm_iszRollerMineClassname, "npc_rollermine"); + gm_iszMortarClassname = AllocPooledString( "func_tankmortar" ); + gm_iszGroundTurretClassname = AllocPooledString( "npc_turret_ground" ); #else gm_iszMortarClassname = AllocPooledString( "func_tankmortar" ); gm_iszFloorTurretClassname = AllocPooledString( "npc_turret_floor" ); diff --git a/sp/src/game/server/hl2/npc_playercompanion.h b/sp/src/game/server/hl2/npc_playercompanion.h index 2165db1c..150eaec0 100644 --- a/sp/src/game/server/hl2/npc_playercompanion.h +++ b/sp/src/game/server/hl2/npc_playercompanion.h @@ -470,7 +470,7 @@ protected: #define gm_iszFloorTurretClassname gm_isz_class_FloorTurret static string_t gm_iszGroundTurretClassname; #define gm_iszShotgunClassname gm_isz_class_Shotgun - static string_t gm_iszRollerMineClassname; + #define gm_iszRollerMineClassname gm_isz_class_Rollermine #define gm_iszSMG1Classname gm_isz_class_SMG1 #define gm_iszAR2Classname gm_isz_class_AR2 #else diff --git a/sp/src/game/server/mapbase/GlobalStrings.cpp b/sp/src/game/server/mapbase/GlobalStrings.cpp index 665e2811..011e9d99 100644 --- a/sp/src/game/server/mapbase/GlobalStrings.cpp +++ b/sp/src/game/server/mapbase/GlobalStrings.cpp @@ -37,6 +37,7 @@ string_t gm_isz_class_Dropship; string_t gm_isz_class_FloorTurret; string_t gm_isz_class_CScanner; string_t gm_isz_class_ClawScanner; +string_t gm_isz_class_Rollermine; #endif string_t gm_isz_class_Bullseye; @@ -68,18 +69,6 @@ inline bool EntIsClass( CBaseEntity *ent, string_t str2 ) return ent->m_iClassname == str2; } -inline void SetGlobalString( string_t &string, const char *text ) -{ - //string = AllocPooledString(text); - - // Entities usually allocate global strings every time one of them spawns, meaning the string could've already been allocated either - // by the same type of entity already being spawned or some other means. - // If it's already allocated, we could easily just use "Find" instead of "Alloc". There's a fallback if we don't find it in the string pool. - string = FindPooledString( text ); - if (string == NULL_STRING) - string = AllocPooledString( text ); -} - // We know it hasn't been allocated yet #define INITIALIZE_GLOBAL_STRING(string, text) string = AllocPooledString(text) //SetGlobalString(string, text) @@ -104,6 +93,7 @@ void InitGlobalStrings() INITIALIZE_GLOBAL_STRING(gm_isz_class_FloorTurret, "npc_turret_floor"); INITIALIZE_GLOBAL_STRING(gm_isz_class_CScanner, "npc_cscanner"); INITIALIZE_GLOBAL_STRING(gm_isz_class_ClawScanner, "npc_clawscanner"); + INITIALIZE_GLOBAL_STRING(gm_isz_class_Rollermine, "npc_rollermine"); #endif INITIALIZE_GLOBAL_STRING(gm_isz_class_Bullseye, "npc_bullseye"); diff --git a/sp/src/game/server/mapbase/GlobalStrings.h b/sp/src/game/server/mapbase/GlobalStrings.h index 2dadb5d4..22d2e494 100644 --- a/sp/src/game/server/mapbase/GlobalStrings.h +++ b/sp/src/game/server/mapbase/GlobalStrings.h @@ -47,6 +47,7 @@ extern string_t gm_isz_class_Dropship; extern string_t gm_isz_class_FloorTurret; extern string_t gm_isz_class_CScanner; extern string_t gm_isz_class_ClawScanner; +extern string_t gm_isz_class_Rollermine; #endif extern string_t gm_isz_class_Bullseye; @@ -68,8 +69,6 @@ extern string_t gm_isz_name_activator; // This function is for comparing global strings and allows us to change how we compare them quickly. extern bool EntIsClass( CBaseEntity *ent, string_t str2 ); -extern void SetGlobalString( string_t &string, const char *text ); - // ------------------------------------------------------------- extern void InitGlobalStrings();