|
|
|
@ -522,11 +522,6 @@ void CBaseMonster::RunTask( Task_t *pTask )
@@ -522,11 +522,6 @@ void CBaseMonster::RunTask( Task_t *pTask )
|
|
|
|
|
if( m_pCine->m_iDelay <= 0 && gpGlobals->time >= m_pCine->m_startTime ) |
|
|
|
|
{ |
|
|
|
|
TaskComplete(); |
|
|
|
|
m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszPlay, TRUE ); |
|
|
|
|
if( m_fSequenceFinished ) |
|
|
|
|
ClearSchedule(); |
|
|
|
|
pev->framerate = 1.0; |
|
|
|
|
//ALERT( at_aiconsole, "Script %s has begun for %s\n", STRING( m_pCine->m_iszPlay ), STRING( pev->classname ) );
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -534,7 +529,18 @@ void CBaseMonster::RunTask( Task_t *pTask )
@@ -534,7 +529,18 @@ void CBaseMonster::RunTask( Task_t *pTask )
|
|
|
|
|
{ |
|
|
|
|
if( m_fSequenceFinished ) |
|
|
|
|
{ |
|
|
|
|
m_pCine->SequenceDone( this ); |
|
|
|
|
ALERT( at_console, "Anim Finished\n" ); |
|
|
|
|
if( m_pCine->m_iRepeatsLeft > 0 ) |
|
|
|
|
{ |
|
|
|
|
//ALERT( at_console, "Frame %f; Repeat %d from %f\n", pev->frame, m_pCine->m_iRepeatsLeft, m_pCine->m_fRepeatFrame );
|
|
|
|
|
m_pCine->m_iRepeatsLeft--; |
|
|
|
|
pev->frame = m_pCine->m_fRepeatFrame; |
|
|
|
|
ResetSequenceInfo(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
TaskComplete(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -892,7 +898,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -892,7 +898,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
{ |
|
|
|
|
Activity newActivity; |
|
|
|
|
|
|
|
|
|
if( ( m_hTargetEnt->pev->origin - pev->origin ).Length() < 1 ) |
|
|
|
|
if( !m_pGoalEnt || ( m_pGoalEnt->pev->origin - pev->origin ).Length() < 1 ) |
|
|
|
|
TaskComplete(); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -906,10 +912,22 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -906,10 +912,22 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
TaskComplete(); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if( m_hTargetEnt == 0 || !MoveToTarget( newActivity, 2 ) ) |
|
|
|
|
if( m_pGoalEnt != NULL ) |
|
|
|
|
{ |
|
|
|
|
Vector vecDest; |
|
|
|
|
vecDest = m_pGoalEnt->pev->origin; |
|
|
|
|
|
|
|
|
|
if( !MoveToLocation( newActivity, 2, vecDest ) ) |
|
|
|
|
{ |
|
|
|
|
TaskFail(); |
|
|
|
|
ALERT( at_aiconsole, "%s Failed to reach script!!!\n", STRING( pev->classname ) ); |
|
|
|
|
RouteClear(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
TaskFail(); |
|
|
|
|
ALERT( at_aiconsole, "%s Failed to reach target!!!\n", STRING( pev->classname ) ); |
|
|
|
|
ALERT( at_aiconsole, "%s: MoveTarget is missing!?!\n", STRING( pev->classname ) ); |
|
|
|
|
RouteClear(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1029,7 +1047,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -1029,7 +1047,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
break; |
|
|
|
|
case TASK_GET_PATH_TO_SPOT: |
|
|
|
|
{ |
|
|
|
|
CBaseEntity *pPlayer = CBaseEntity::Instance( FIND_ENTITY_BY_CLASSNAME( NULL, "player" ) ); |
|
|
|
|
CBaseEntity *pPlayer = UTIL_FindEntityByClassname( 0, "player" ); |
|
|
|
|
if( BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, pPlayer ) ) |
|
|
|
|
{ |
|
|
|
|
TaskComplete(); |
|
|
|
@ -1057,6 +1075,21 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -1057,6 +1075,21 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TASK_GET_PATH_TO_SCRIPT: |
|
|
|
|
{ |
|
|
|
|
RouteClear(); |
|
|
|
|
if( m_pCine != 0 && MoveToLocation( m_movementActivity, 1, m_pCine->pev->origin ) ) |
|
|
|
|
{ |
|
|
|
|
TaskComplete(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// no way to get there =(
|
|
|
|
|
ALERT( at_aiconsole, "GetPathToSpot failed!!\n" ); |
|
|
|
|
TaskFail(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TASK_GET_PATH_TO_HINTNODE: |
|
|
|
|
// for active idles!
|
|
|
|
|
{ |
|
|
|
@ -1247,11 +1280,11 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -1247,11 +1280,11 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
} |
|
|
|
|
case TASK_WAIT_FOR_SCRIPT: |
|
|
|
|
{ |
|
|
|
|
if ( m_pCine->m_iDelay <= 0 && gpGlobals->time >= m_pCine->m_startTime ) |
|
|
|
|
if( m_pCine->m_iDelay <= 0 && gpGlobals->time >= m_pCine->m_startTime ) |
|
|
|
|
{ |
|
|
|
|
TaskComplete(); //LRC - start playing immediately
|
|
|
|
|
} |
|
|
|
|
if( m_pCine->m_iszIdle ) |
|
|
|
|
else if( !m_pCine->IsAction() && m_pCine->m_iszIdle ) |
|
|
|
|
{ |
|
|
|
|
m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszIdle, FALSE ); |
|
|
|
|
if( FStrEq( STRING( m_pCine->m_iszIdle ), STRING( m_pCine->m_iszPlay ) ) ) |
|
|
|
@ -1265,8 +1298,48 @@ void CBaseMonster::StartTask( Task_t *pTask )
@@ -1265,8 +1298,48 @@ void CBaseMonster::StartTask( Task_t *pTask )
|
|
|
|
|
} |
|
|
|
|
case TASK_PLAY_SCRIPT: |
|
|
|
|
{ |
|
|
|
|
if( m_pCine->IsAction() ) |
|
|
|
|
{ |
|
|
|
|
// ALERT( at_console, "PlayScript: setting idealactivity %d\n",m_pCine->m_fAction );
|
|
|
|
|
switch( m_pCine->m_fAction ) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
m_IdealActivity = ACT_RANGE_ATTACK1; |
|
|
|
|
break; |
|
|
|
|
case 1: |
|
|
|
|
m_IdealActivity = ACT_RANGE_ATTACK2; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
m_IdealActivity = ACT_MELEE_ATTACK1; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
m_IdealActivity = ACT_MELEE_ATTACK2; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
m_IdealActivity = ACT_SPECIAL_ATTACK1; |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
m_IdealActivity = ACT_SPECIAL_ATTACK2; |
|
|
|
|
break; |
|
|
|
|
case 6: |
|
|
|
|
m_IdealActivity = ACT_RELOAD; |
|
|
|
|
break; |
|
|
|
|
case 7: |
|
|
|
|
m_IdealActivity = ACT_HOP; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
pev->framerate = 1.0; // shouldn't be needed, but just in case
|
|
|
|
|
pev->movetype = MOVETYPE_FLY; |
|
|
|
|
ClearBits( pev->flags, FL_ONGROUND ); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszPlay, TRUE ); |
|
|
|
|
if( m_fSequenceFinished ) |
|
|
|
|
ClearSchedule(); |
|
|
|
|
pev->framerate = 1.0; |
|
|
|
|
//ALERT( at_aiconsole, "Script %s has begun for %s\n", STRING( m_pCine->m_iszPlay ), STRING( pev->classname ) );
|
|
|
|
|
} |
|
|
|
|
m_scriptState = SCRIPT_PLAYING; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|