Browse Source

Revert changes in schedule.cpp.

cthulhu
Night Owl 7 years ago
parent
commit
337799d811
  1. 97
      dlls/schedule.cpp

97
dlls/schedule.cpp

@ -522,11 +522,6 @@ void CBaseMonster::RunTask( Task_t *pTask )
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(); 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; break;
} }
@ -534,7 +529,18 @@ void CBaseMonster::RunTask( Task_t *pTask )
{ {
if( m_fSequenceFinished ) 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; break;
} }
@ -892,7 +898,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
{ {
Activity newActivity; Activity newActivity;
if( ( m_hTargetEnt->pev->origin - pev->origin ).Length() < 1 ) if( !m_pGoalEnt || ( m_pGoalEnt->pev->origin - pev->origin ).Length() < 1 )
TaskComplete(); TaskComplete();
else else
{ {
@ -906,10 +912,22 @@ void CBaseMonster::StartTask( Task_t *pTask )
TaskComplete(); TaskComplete();
else 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(); 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(); RouteClear();
} }
} }
@ -1029,7 +1047,7 @@ void CBaseMonster::StartTask( Task_t *pTask )
break; break;
case TASK_GET_PATH_TO_SPOT: 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 ) ) if( BuildRoute( m_vecMoveGoal, bits_MF_TO_LOCATION, pPlayer ) )
{ {
TaskComplete(); TaskComplete();
@ -1057,6 +1075,21 @@ void CBaseMonster::StartTask( Task_t *pTask )
} }
break; 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: case TASK_GET_PATH_TO_HINTNODE:
// for active idles! // for active idles!
{ {
@ -1247,11 +1280,11 @@ void CBaseMonster::StartTask( Task_t *pTask )
} }
case TASK_WAIT_FOR_SCRIPT: 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 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 ); m_pCine->StartSequence( (CBaseMonster *)this, m_pCine->m_iszIdle, FALSE );
if( FStrEq( STRING( m_pCine->m_iszIdle ), STRING( m_pCine->m_iszPlay ) ) ) if( FStrEq( STRING( m_pCine->m_iszIdle ), STRING( m_pCine->m_iszPlay ) ) )
@ -1265,8 +1298,48 @@ void CBaseMonster::StartTask( Task_t *pTask )
} }
case TASK_PLAY_SCRIPT: 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; pev->movetype = MOVETYPE_FLY;
ClearBits( pev->flags, FL_ONGROUND ); 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; m_scriptState = SCRIPT_PLAYING;
break; break;
} }

Loading…
Cancel
Save