Add OnScriptEvent outputs to ai_hint

This commit is contained in:
ALLEN-PC\acj30 2024-01-03 12:49:10 -06:00
parent e44f60e8d8
commit 0d37ded0eb
3 changed files with 37 additions and 0 deletions

View File

@ -9526,6 +9526,12 @@ void CAI_BaseNPC::HandleAnimEvent( animevent_t *pEvent )
{
m_hCine->FireScriptEvent( atoi( pEvent->options ) );
}
#ifdef MAPBASE
else if ( GetHintNode() )
{
GetHintNode()->FireScriptEvent( atoi( pEvent->options ) );
}
#endif
else
{
// FIXME: look so see if it's playing a vcd and fire those instead

View File

@ -902,6 +902,17 @@ BEGIN_DATADESC( CAI_Hint )
DEFINE_OUTPUT( m_OnNPCStartedUsing, "OnNPCStartedUsing" ),
DEFINE_OUTPUT( m_OnNPCStoppedUsing, "OnNPCStoppedUsing" ),
#ifdef MAPBASE
DEFINE_OUTPUT( m_OnScriptEvent[0], "OnScriptEvent01" ),
DEFINE_OUTPUT( m_OnScriptEvent[1], "OnScriptEvent02" ),
DEFINE_OUTPUT( m_OnScriptEvent[2], "OnScriptEvent03" ),
DEFINE_OUTPUT( m_OnScriptEvent[3], "OnScriptEvent04" ),
DEFINE_OUTPUT( m_OnScriptEvent[4], "OnScriptEvent05" ),
DEFINE_OUTPUT( m_OnScriptEvent[5], "OnScriptEvent06" ),
DEFINE_OUTPUT( m_OnScriptEvent[6], "OnScriptEvent07" ),
DEFINE_OUTPUT( m_OnScriptEvent[7], "OnScriptEvent08" ),
#endif
END_DATADESC( );
#ifdef MAPBASE_VSCRIPT
@ -1705,6 +1716,19 @@ void CAI_Hint::NPCStoppedUsing( CAI_BaseNPC *pNPC )
m_OnNPCStoppedUsing.Set( pNPC, pNPC, this );
}
#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAI_Hint::FireScriptEvent( int nEvent )
{
if ( ( nEvent >= 1 ) && ( nEvent <= 8 ) )
{
m_OnScriptEvent[nEvent - 1].FireOutput( m_hHintOwner, this );
}
}
#endif
CON_COMMAND(ai_dump_hints, "")
{

View File

@ -323,6 +323,9 @@ public:
void FixupTargetNode();
void NPCStartedUsing( CAI_BaseNPC *pNPC );
void NPCStoppedUsing( CAI_BaseNPC *pNPC );
#ifdef MAPBASE
void FireScriptEvent( int nEvent );
#endif
HintIgnoreFacing_t GetIgnoreFacing() const { return m_NodeData.fIgnoreFacing; }
@ -385,6 +388,10 @@ private:
float m_nodeFOV;
Vector m_vecForward;
#ifdef MAPBASE
COutputEvent m_OnScriptEvent[8];
#endif
// The next hint in list of all hints
friend class CAI_HintManager;