Merged dev changes 9/30/2019

- Added DMG_PREVENT_PHYSICS_FORCE to dynamic interaction tests
- Fixed response context $ in base entities
- Miscellaneous code changes
This commit is contained in:
Blixibon 2019-09-30 15:49:42 +00:00
parent dd9f5ac766
commit 8ebe43d5d4
7 changed files with 38 additions and 25 deletions

View File

@ -14674,7 +14674,12 @@ void CAI_BaseNPC::CalculateValidEnemyInteractions( void )
// If we have a damage filter that prevents us hurting the enemy, // If we have a damage filter that prevents us hurting the enemy,
// don't interact with him, since most interactions kill the enemy. // don't interact with him, since most interactions kill the enemy.
// Create a fake damage info to test it with. // 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 ); CTakeDamageInfo tempinfo( this, this, vec3_origin, vec3_origin, 1.0, DMG_BULLET );
#endif
if ( !pNPC->PassesDamageFilter( tempinfo ) ) if ( !pNPC->PassesDamageFilter( tempinfo ) )
continue; continue;

View File

@ -8012,10 +8012,31 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
#ifdef MAPBASE #ifdef MAPBASE
if (response[0] == '$') if (response[0] == '$')
{ {
response[0] = '\0'; const char *context = response + 1;
DevMsg("Replacing %s with %s...\n", response, GetContextValue(response)); const char *replace = GetContextValue(context);
Q_strncpy(response, GetContextValue(response), sizeof(response));
PrecacheScriptSound( response ); 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 #endif
switch ( result.GetType() ) switch ( result.GetType() )

View File

@ -42,7 +42,7 @@ int g_fCombineQuestion; // true if an idle grunt asked a question. Cleared wh
#ifdef MAPBASE #ifdef MAPBASE
ConVar npc_combine_idle_walk_easy("npc_combine_idle_walk_easy", "1"); 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_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 #endif
#define COMBINE_SKIN_DEFAULT 0 #define COMBINE_SKIN_DEFAULT 0
@ -3362,7 +3362,7 @@ bool CNPC_Combine::CanAltFireEnemy( bool bUseFreeKnowledge )
// "Our weapons alone cannot take down the antlion guard!" // "Our weapons alone cannot take down the antlion guard!"
// "Wait, you're an elite, don't you have, like, disintegration balls or somethi--" // "Wait, you're an elite, don't you have, like, disintegration balls or somethi--"
// "SHUT UP!" // "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 #else
if( !pEnemy->IsPlayer() && (!pEnemy->IsNPC() || !pEnemy->MyNPCPointer()->IsPlayerAlly()) ) if( !pEnemy->IsPlayer() && (!pEnemy->IsNPC() || !pEnemy->MyNPCPointer()->IsPlayerAlly()) )
#endif #endif

View File

@ -160,7 +160,6 @@ bool CNPC_PlayerCompanion::gm_bFindingCoverFromAllEnemies;
#ifdef MAPBASE #ifdef MAPBASE
string_t CNPC_PlayerCompanion::gm_iszMortarClassname; string_t CNPC_PlayerCompanion::gm_iszMortarClassname;
string_t CNPC_PlayerCompanion::gm_iszGroundTurretClassname; string_t CNPC_PlayerCompanion::gm_iszGroundTurretClassname;
string_t CNPC_PlayerCompanion::gm_iszRollerMineClassname;
#else #else
string_t CNPC_PlayerCompanion::gm_iszMortarClassname; string_t CNPC_PlayerCompanion::gm_iszMortarClassname;
string_t CNPC_PlayerCompanion::gm_iszFloorTurretClassname; string_t CNPC_PlayerCompanion::gm_iszFloorTurretClassname;
@ -206,9 +205,8 @@ bool CNPC_PlayerCompanion::CreateBehaviors()
void CNPC_PlayerCompanion::Precache() void CNPC_PlayerCompanion::Precache()
{ {
#ifdef MAPBASE #ifdef MAPBASE
SetGlobalString(gm_iszMortarClassname, "func_tankmortar"); gm_iszMortarClassname = AllocPooledString( "func_tankmortar" );
SetGlobalString(gm_iszGroundTurretClassname, "npc_turret_ground"); gm_iszGroundTurretClassname = AllocPooledString( "npc_turret_ground" );
SetGlobalString(gm_iszRollerMineClassname, "npc_rollermine");
#else #else
gm_iszMortarClassname = AllocPooledString( "func_tankmortar" ); gm_iszMortarClassname = AllocPooledString( "func_tankmortar" );
gm_iszFloorTurretClassname = AllocPooledString( "npc_turret_floor" ); gm_iszFloorTurretClassname = AllocPooledString( "npc_turret_floor" );

View File

@ -470,7 +470,7 @@ protected:
#define gm_iszFloorTurretClassname gm_isz_class_FloorTurret #define gm_iszFloorTurretClassname gm_isz_class_FloorTurret
static string_t gm_iszGroundTurretClassname; static string_t gm_iszGroundTurretClassname;
#define gm_iszShotgunClassname gm_isz_class_Shotgun #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_iszSMG1Classname gm_isz_class_SMG1
#define gm_iszAR2Classname gm_isz_class_AR2 #define gm_iszAR2Classname gm_isz_class_AR2
#else #else

View File

@ -37,6 +37,7 @@ string_t gm_isz_class_Dropship;
string_t gm_isz_class_FloorTurret; string_t gm_isz_class_FloorTurret;
string_t gm_isz_class_CScanner; string_t gm_isz_class_CScanner;
string_t gm_isz_class_ClawScanner; string_t gm_isz_class_ClawScanner;
string_t gm_isz_class_Rollermine;
#endif #endif
string_t gm_isz_class_Bullseye; string_t gm_isz_class_Bullseye;
@ -68,18 +69,6 @@ inline bool EntIsClass( CBaseEntity *ent, string_t str2 )
return ent->m_iClassname == 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 // We know it hasn't been allocated yet
#define INITIALIZE_GLOBAL_STRING(string, text) string = AllocPooledString(text) //SetGlobalString(string, text) #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_FloorTurret, "npc_turret_floor");
INITIALIZE_GLOBAL_STRING(gm_isz_class_CScanner, "npc_cscanner"); INITIALIZE_GLOBAL_STRING(gm_isz_class_CScanner, "npc_cscanner");
INITIALIZE_GLOBAL_STRING(gm_isz_class_ClawScanner, "npc_clawscanner"); INITIALIZE_GLOBAL_STRING(gm_isz_class_ClawScanner, "npc_clawscanner");
INITIALIZE_GLOBAL_STRING(gm_isz_class_Rollermine, "npc_rollermine");
#endif #endif
INITIALIZE_GLOBAL_STRING(gm_isz_class_Bullseye, "npc_bullseye"); INITIALIZE_GLOBAL_STRING(gm_isz_class_Bullseye, "npc_bullseye");

View File

@ -47,6 +47,7 @@ extern string_t gm_isz_class_Dropship;
extern string_t gm_isz_class_FloorTurret; extern string_t gm_isz_class_FloorTurret;
extern string_t gm_isz_class_CScanner; extern string_t gm_isz_class_CScanner;
extern string_t gm_isz_class_ClawScanner; extern string_t gm_isz_class_ClawScanner;
extern string_t gm_isz_class_Rollermine;
#endif #endif
extern string_t gm_isz_class_Bullseye; 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. // 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 bool EntIsClass( CBaseEntity *ent, string_t str2 );
extern void SetGlobalString( string_t &string, const char *text );
// ------------------------------------------------------------- // -------------------------------------------------------------
extern void InitGlobalStrings(); extern void InitGlobalStrings();