mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Added prototype Response System library port from the Alien Swarm SDK
This commit is contained in:
38
sp/src/game/shared/ai_criteria_new.cpp
Normal file
38
sp/src/game/shared/ai_criteria_new.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//===========================================================================//
|
||||
#include "cbase.h"
|
||||
#include "ai_criteria.h"
|
||||
|
||||
#ifdef GAME_DLL
|
||||
#include "ai_speech.h"
|
||||
#endif
|
||||
|
||||
#include <keyvalues.h>
|
||||
#include "engine/ienginesound.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include <tier0/memdbgon.h>
|
||||
|
||||
|
||||
|
||||
BEGIN_SIMPLE_DATADESC( AI_ResponseParams )
|
||||
DEFINE_FIELD( flags, FIELD_SHORT ),
|
||||
DEFINE_FIELD( odds, FIELD_SHORT ),
|
||||
DEFINE_FIELD( soundlevel, FIELD_CHARACTER ),
|
||||
DEFINE_FIELD( delay, FIELD_INTEGER ), // These are compressed down to two float16s, so treat as an INT for saverestore
|
||||
DEFINE_FIELD( respeakdelay, FIELD_INTEGER ), //
|
||||
END_DATADESC()
|
||||
|
||||
BEGIN_SIMPLE_DATADESC( AI_Response )
|
||||
DEFINE_FIELD( m_Type, FIELD_CHARACTER ),
|
||||
DEFINE_ARRAY( m_szResponseName, FIELD_CHARACTER, AI_Response::MAX_RESPONSE_NAME ),
|
||||
DEFINE_ARRAY( m_szMatchingRule, FIELD_CHARACTER, AI_Response::MAX_RULE_NAME ),
|
||||
// DEFINE_FIELD( m_pCriteria, FIELD_??? ), // Don't need to save this probably
|
||||
DEFINE_EMBEDDED( m_Params ),
|
||||
END_DATADESC()
|
||||
|
||||
41
sp/src/game/shared/ai_criteria_new.h
Normal file
41
sp/src/game/shared/ai_criteria_new.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef AI_CRITERIA_H
|
||||
#define AI_CRITERIA_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier1/utlrbtree.h"
|
||||
#include "tier1/utlsymbol.h"
|
||||
#include "tier1/interval.h"
|
||||
#include "mathlib/compressed_vector.h"
|
||||
#include "../../public/responserules/response_types.h"
|
||||
|
||||
|
||||
using ResponseRules::ResponseType_t;
|
||||
|
||||
extern const char *SplitContext( const char *raw, char *key, int keylen, char *value, int valuelen, float *duration, const char *entireContext );
|
||||
|
||||
#ifndef AI_CriteriaSet
|
||||
#define AI_CriteriaSet ResponseRules::CriteriaSet
|
||||
#endif
|
||||
|
||||
typedef ResponseRules::ResponseParams AI_ResponseParams ;
|
||||
typedef ResponseRules::CRR_Response AI_Response;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// An AI response that is dynamically new'ed up and returned from SpeakFindResponse.
|
||||
class AI_ResponseReturnValue : AI_Response
|
||||
{
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
#endif // AI_CRITERIA_H
|
||||
1271
sp/src/game/shared/ai_responsesystem_new.cpp
Normal file
1271
sp/src/game/shared/ai_responsesystem_new.cpp
Normal file
File diff suppressed because it is too large
Load Diff
29
sp/src/game/shared/ai_responsesystem_new.h
Normal file
29
sp/src/game/shared/ai_responsesystem_new.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef AI_RESPONSESYSTEM_H
|
||||
#define AI_RESPONSESYSTEM_H
|
||||
|
||||
#include "utlvector.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "ai_criteria.h"
|
||||
#include "../../public/responserules/response_types.h"
|
||||
|
||||
// using ResponseRules::IResponseFilter;
|
||||
// using ResponseRules::IResponseSystem;
|
||||
|
||||
ResponseRules::IResponseSystem *PrecacheCustomResponseSystem( const char *scriptfile );
|
||||
ResponseRules::IResponseSystem *BuildCustomResponseSystemGivenCriteria( const char *pszBaseFile, const char *pszCustomName, AI_CriteriaSet &criteriaSet, float flCriteriaScore );
|
||||
void DestroyCustomResponseSystems();
|
||||
|
||||
class ISaveRestoreBlockHandler *GetDefaultResponseSystemSaveRestoreBlockHandler();
|
||||
class ISaveRestoreOps *GetResponseSystemSaveRestoreOps();
|
||||
|
||||
#endif // AI_RESPONSESYSTEM_H
|
||||
28
sp/src/game/shared/ai_speechconcept.cpp
Normal file
28
sp/src/game/shared/ai_speechconcept.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "ai_speechconcept.h"
|
||||
|
||||
#ifdef GAME_DLL
|
||||
#include "game.h"
|
||||
#include "ai_basenpc.h"
|
||||
#include "sceneentity.h"
|
||||
#endif
|
||||
|
||||
#include "engine/ienginesound.h"
|
||||
#include "keyvalues.h"
|
||||
#include "ai_criteria.h"
|
||||
#include "isaverestore.h"
|
||||
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include <tier0/memdbgon.h>
|
||||
|
||||
|
||||
// empty
|
||||
45
sp/src/game/shared/ai_speechconcept.h
Normal file
45
sp/src/game/shared/ai_speechconcept.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Class data for an AI Concept, an atom of response-driven dialog.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef AI_SPEECHCONCEPT_H
|
||||
#define AI_SPEECHCONCEPT_H
|
||||
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "../../public/responserules/response_types.h"
|
||||
|
||||
class CAI_Concept : public ResponseRules::CRR_Concept
|
||||
{
|
||||
public:
|
||||
CAI_Concept() {};
|
||||
// construct concept from a string.
|
||||
CAI_Concept(const char *fromString) : CRR_Concept(fromString) {} ;
|
||||
|
||||
// get/set BS
|
||||
inline EHANDLE GetSpeaker() const { return m_hSpeaker; }
|
||||
inline void SetSpeaker(EHANDLE val) { m_hSpeaker = val; }
|
||||
|
||||
/*
|
||||
inline EHANDLE GetTarget() const { return m_hTarget; }
|
||||
inline void SetTarget(EHANDLE val) { m_hTarget = val; }
|
||||
inline EHANDLE GetTopic() const { return m_hTopic; }
|
||||
inline void SetTopic(EHANDLE val) { m_hTopic = val; }
|
||||
*/
|
||||
|
||||
protected:
|
||||
EHANDLE m_hSpeaker;
|
||||
|
||||
/*
|
||||
EHANDLE m_hTarget;
|
||||
EHANDLE m_hTopic;
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "interval.h"
|
||||
#include "tier1/strtools.h"
|
||||
#include "vstdlib/random.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *pString -
|
||||
// Output : interval_t
|
||||
//-----------------------------------------------------------------------------
|
||||
interval_t ReadInterval( const char *pString )
|
||||
{
|
||||
interval_t tmp;
|
||||
|
||||
tmp.start = 0;
|
||||
tmp.range = 0;
|
||||
|
||||
char tempString[128];
|
||||
Q_strncpy( tempString, pString, sizeof(tempString) );
|
||||
|
||||
char *token = strtok( tempString, "," );
|
||||
if ( token )
|
||||
{
|
||||
tmp.start = atof( token );
|
||||
token = strtok( NULL, "," );
|
||||
if ( token )
|
||||
{
|
||||
tmp.range = atof( token ) - tmp.start;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : &interval -
|
||||
// Output : float
|
||||
//-----------------------------------------------------------------------------
|
||||
float RandomInterval( const interval_t &interval )
|
||||
{
|
||||
float out = interval.start;
|
||||
if ( interval.range != 0 )
|
||||
{
|
||||
out += RandomFloat( 0, interval.range );
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef INTERVAL_H
|
||||
#define INTERVAL_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "basetypes.h"
|
||||
|
||||
|
||||
interval_t ReadInterval( const char *pString );
|
||||
float RandomInterval( const interval_t &interval );
|
||||
|
||||
#endif // INTERVAL_H
|
||||
Reference in New Issue
Block a user