mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing * - Added support for regular expression matching - Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp - Fixed env_global_light brightness - Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro) - New UnZoomWithRate and SetZoomRate inputs on env_zoom - New "Don't change target's angles" flag on logic_measure_movement - Fixed logic_measure_movement not using ignore origin flags correctly - Fixed filter_damage_mod secondary filter not recognizing mode correctly - Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code - Added SetEntityName input for setting an entity's targetname - Added "SetTarget" support to point_posecontroller - Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health - Added ignore flags and several direction-related inputs to math_vector - Added pose parameter stuff to logic_modelinfo - Fixed ChangeWeapon not changing during combat - Fixed holster/unholster on NPCs without holster/unholster animations - Fixed func_tank and other "player in the way" code ignoring notarget - Added SetPoseParameter input to animating entities - Introduced an experimental chapter system which allows for custom chapter title/restriction management - Added SetChapterTitle input to worldspawn for dynamic title changing - Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues - Fixed mapbase_rpc_enabled not actually affecting RPC - Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users - Fixed some problems with the new shared activities - Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity - Added env_microphone pitch scale for scaling the pitch of transmitted sounds - Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT - Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing - Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders - Areaportal leaks now stop compilation in leaktest - Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
This commit is contained in:
@@ -110,6 +110,8 @@ public:
|
||||
// Soldiers use "lefthand", cops use "LHand", and citizens use "anim_attachment_LH"
|
||||
virtual const char* GetGrenadeAttachment() { return "anim_attachment_LH"; }
|
||||
|
||||
void ClearAttackConditions( void );
|
||||
|
||||
Vector GetAltFireTarget() { return m_vecAltFireTarget; }
|
||||
virtual bool CanAltFireEnemy( bool bUseFreeKnowledge );
|
||||
void DelayAltFireAttack( float flDelay );
|
||||
@@ -493,6 +495,31 @@ bool CAI_GrenadeUser<BASE_NPC>::CheckCanThrowGrenade( const Vector &vecTarget )
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: This was copied from soldier code for general AI grenades.
|
||||
//
|
||||
// "Soldiers use CAN_RANGE_ATTACK2 to indicate whether they can throw
|
||||
// a grenade. Because they check only every half-second or so, this
|
||||
// condition must persist until it is updated again by the code
|
||||
// that determines whether a grenade can be thrown, so prevent the
|
||||
// base class from clearing it out. (sjb)"
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class BASE_NPC>
|
||||
void CAI_GrenadeUser<BASE_NPC>::ClearAttackConditions()
|
||||
{
|
||||
bool fCanRangeAttack2 = IsGrenadeCapable() && HasCondition( COND_CAN_RANGE_ATTACK2 );
|
||||
|
||||
// Call the base class.
|
||||
BaseClass::ClearAttackConditions();
|
||||
|
||||
if( fCanRangeAttack2 )
|
||||
{
|
||||
// We don't allow the base class to clear this condition because we
|
||||
// don't sense for it every frame.
|
||||
SetCondition( COND_CAN_RANGE_ATTACK2 );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Task helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. =================
|
||||
//
|
||||
// Purpose: General matching functions for things like wildcards and !=.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#define MAPBASE_MATCHERS 1
|
||||
|
||||
extern bool ResponseSystemCompare(const char *criterion, const char *value);
|
||||
//extern const char *ResponseSystemCompare(const char *criterion, const char *value, bool bReturnToken);
|
||||
|
||||
//=============================================================================
|
||||
// These are the "matchers" that compare with wildcards (any*) and operators (<3).
|
||||
//
|
||||
// Matcher_Match - Supports operators and wildcards.
|
||||
// Matcher_NamesMatch - Only supports wildcards.
|
||||
// Matcher_Compare - Long story short, Matcher_Match didn't support wildcards before.
|
||||
// This was used to support both matchers and wildcards.
|
||||
// Now it just redirects to Matcher_Match.
|
||||
//
|
||||
// AppearsToBeANumber - Checks if the string might be a number.
|
||||
// Stolen from the Response System, just like the other matchers.
|
||||
//=============================================================================
|
||||
|
||||
// Compares with != and the like. Basically hijacks the response system matching.
|
||||
// Now supports trailing wildcards (query* == querything)
|
||||
// pszQuery = The value that should have the operator(s) at the beginning
|
||||
// szValue = The value tested against the criterion
|
||||
inline bool Matcher_Match(const char *pszQuery, const char *szValue)
|
||||
{
|
||||
// I wasn't kidding when I said all this did was hijack response system matching.
|
||||
return ResponseSystemCompare(pszQuery, szValue);
|
||||
// (pszQuery && szValue) ? ResponseSystemCompare(pszQuery, szValue, pass) : FStrEq(pszQuery, szValue);
|
||||
}
|
||||
|
||||
inline bool Matcher_Match(const char *pszQuery, int iValue)
|
||||
{
|
||||
return Matcher_Match(pszQuery, UTIL_VarArgs("%i", iValue));
|
||||
}
|
||||
|
||||
// Compares two strings with trailing wildcards. Nothing more. Use Matcher_Match if you want <, !=, etc.
|
||||
// pszQuery = The value that should have the wildcard.
|
||||
// szValue = The value tested against the query.
|
||||
// It's basically just baseentity.cpp's NamesMatch().
|
||||
FORCEINLINE bool Matcher_NamesMatch(const char *pszQuery, const char *szValue)
|
||||
{
|
||||
if ( szValue == NULL )
|
||||
return (!pszQuery || *pszQuery == 0 || *pszQuery == '*');
|
||||
|
||||
// If the pointers are identical, we're identical
|
||||
if ( szValue == pszQuery )
|
||||
return true;
|
||||
|
||||
while ( *szValue && *pszQuery )
|
||||
{
|
||||
unsigned char cName = *szValue;
|
||||
unsigned char cQuery = *pszQuery;
|
||||
// simple ascii case conversion
|
||||
if ( cName == cQuery )
|
||||
;
|
||||
else if ( cName - 'A' <= (unsigned char)'Z' - 'A' && cName - 'A' + 'a' == cQuery )
|
||||
;
|
||||
else if ( cName - 'a' <= (unsigned char)'z' - 'a' && cName - 'a' + 'A' == cQuery )
|
||||
;
|
||||
else
|
||||
break;
|
||||
++szValue;
|
||||
++pszQuery;
|
||||
}
|
||||
|
||||
if ( *pszQuery == 0 && *szValue == 0 )
|
||||
return true;
|
||||
|
||||
// @TODO (toml 03-18-03): Perhaps support real wildcards. Right now, only thing supported is trailing *
|
||||
if ( *pszQuery == '*' )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Identical to Matcher_NamesMatch(), but either value could use a wildcard.
|
||||
// pszQuery = The value that serves as the query. This value can use wildcards.
|
||||
// szValue = The value tested against the query. This value can use wildcards as well.
|
||||
FORCEINLINE bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const char *szValue)
|
||||
{
|
||||
if ( szValue == NULL )
|
||||
return (!pszQuery || *pszQuery == 0 || *pszQuery == '*');
|
||||
|
||||
if ( pszQuery == NULL )
|
||||
return (!szValue || *szValue == 0 || *szValue == '*');
|
||||
|
||||
// If the pointers are identical, we're identical
|
||||
if ( szValue == pszQuery )
|
||||
return true;
|
||||
|
||||
while ( *szValue && *pszQuery )
|
||||
{
|
||||
unsigned char cName = *szValue;
|
||||
unsigned char cQuery = *pszQuery;
|
||||
// simple ascii case conversion
|
||||
if ( cName == cQuery )
|
||||
;
|
||||
else if ( cName - 'A' <= (unsigned char)'Z' - 'A' && cName - 'A' + 'a' == cQuery )
|
||||
;
|
||||
else if ( cName - 'a' <= (unsigned char)'z' - 'a' && cName - 'a' + 'A' == cQuery )
|
||||
;
|
||||
else
|
||||
break;
|
||||
++szValue;
|
||||
++pszQuery;
|
||||
}
|
||||
|
||||
if ( *pszQuery == 0 && *szValue == 0 )
|
||||
return true;
|
||||
|
||||
// @TODO (toml 03-18-03): Perhaps support real wildcards. Right now, only thing supported is trailing *
|
||||
if ( *pszQuery == '*' || *szValue == '*' )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// While Matcher_Match didn't support wildcards,
|
||||
// this was used to match with both matchers and wildcards.
|
||||
// Now that Matcher_Match supports wildcards, it just redirects to that,
|
||||
// but I use this anyway for consistency purposes and force-of-habit.
|
||||
// pszQuery = The value that should have the operator or wildcard
|
||||
// szValue = The value tested against the criterion
|
||||
inline bool Matcher_Compare(const char *pszQuery, const char *szValue)
|
||||
{
|
||||
return Matcher_Match(pszQuery, szValue);
|
||||
#if 0
|
||||
// I have to do this so wildcards could test *before* the response system comparison.
|
||||
// I know it removes the operators twice, but I won't worry about it.
|
||||
bool match = Matcher_NamesMatch(Matcher_RemoveOperators(pszQuery), szValue);
|
||||
if (match)
|
||||
return Matcher_Match(pszQuery, szValue);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Yeeted right out of the Response System.
|
||||
// Checks if the specified string appears to be a number of some sort.
|
||||
static bool AppearsToBeANumber( char const *token )
|
||||
{
|
||||
if ( atof( token ) != 0.0f )
|
||||
return true;
|
||||
|
||||
char const *p = token;
|
||||
while ( *p )
|
||||
{
|
||||
if ( *p != '0' )
|
||||
return false;
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user