Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
4.7 KiB

9 years ago
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
//=========================================================
// Default behaviors.
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "defaultai.h"
#include "nodes.h"
#include "scripted.h"
Schedule_t *CBaseMonster::ScheduleFromName( const char *pName )
{
8 years ago
return ScheduleInList( pName, m_scheduleList, ARRAYSIZE( m_scheduleList ) );
9 years ago
}
8 years ago
Schedule_t *CBaseMonster::ScheduleInList( const char *pName, Schedule_t **pList, int listCount )
9 years ago
{
int i;
8 years ago
if( !pName )
9 years ago
{
8 years ago
ALERT( at_console, "%s set to unnamed schedule!\n", STRING( pev->classname ) );
9 years ago
return NULL;
}
8 years ago
for( i = 0; i < listCount; i++ )
9 years ago
{
8 years ago
if( !pList[i]->pName )
9 years ago
{
ALERT( at_console, "Unnamed schedule!\n" );
continue;
}
8 years ago
if( stricmp( pName, pList[i]->pName ) == 0 )
9 years ago
return pList[i];
}
return NULL;
}
//=========================================================
// GetScheduleOfType - returns a pointer to one of the
// monster's available schedules of the indicated type.
//=========================================================
8 years ago
Schedule_t* CBaseMonster::GetScheduleOfType( int Type )
9 years ago
{
8 years ago
//ALERT( at_console, "Sched Type:%d\n", Type );
switch( Type )
9 years ago
{
// This is the schedule for scripted sequences AND scripted AI
case SCHED_AISCRIPT:
{
ASSERT( m_pCine != NULL );
8 years ago
if( !m_pCine )
9 years ago
{
8 years ago
ALERT( at_aiconsole, "Script failed for %s\n", STRING( pev->classname ) );
9 years ago
CineCleanup();
return GetScheduleOfType( SCHED_IDLE_STAND );
}
8 years ago
//else
// ALERT( at_aiconsole, "Starting script %s for %s\n", STRING( m_pCine->m_iszPlay ), STRING( pev->classname ) );
9 years ago
8 years ago
switch( m_pCine->m_fMoveTo )
9 years ago
{
8 years ago
case 0:
case 4:
9 years ago
return slWaitScript;
8 years ago
case 1:
9 years ago
return slWalkToScript;
8 years ago
case 2:
9 years ago
return slRunToScript;
case 5:
return slFaceScript;
}
break;
}
case SCHED_IDLE_STAND:
{
8 years ago
if( RANDOM_LONG( 0, 14 ) == 0 && FCanActiveIdle() )
9 years ago
{
8 years ago
return &slActiveIdle[0];
9 years ago
}
8 years ago
return &slIdleStand[0];
9 years ago
}
case SCHED_IDLE_WALK:
{
8 years ago
return &slIdleWalk[0];
9 years ago
}
case SCHED_WAIT_TRIGGER:
{
8 years ago
return &slIdleTrigger[0];
9 years ago
}
case SCHED_WAKE_ANGRY:
{
8 years ago
return &slWakeAngry[0];
9 years ago
}
case SCHED_ALERT_FACE:
{
8 years ago
return &slAlertFace[0];
9 years ago
}
case SCHED_ALERT_STAND:
{
8 years ago
return &slAlertStand[0];
9 years ago
}
case SCHED_COMBAT_STAND:
{
8 years ago
return &slCombatStand[0];
9 years ago
}
case SCHED_COMBAT_FACE:
{
8 years ago
return &slCombatFace[0];
9 years ago
}
case SCHED_CHASE_ENEMY:
{
8 years ago
return &slChaseEnemy[0];
9 years ago
}
case SCHED_CHASE_ENEMY_FAILED:
{
8 years ago
return &slFail[0];
9 years ago
}
case SCHED_SMALL_FLINCH:
{
8 years ago
return &slSmallFlinch[0];
9 years ago
}
case SCHED_ALERT_SMALL_FLINCH:
{
8 years ago
return &slAlertSmallFlinch[0];
9 years ago
}
case SCHED_RELOAD:
{
8 years ago
return &slReload[0];
9 years ago
}
case SCHED_ARM_WEAPON:
{
8 years ago
return &slArmWeapon[0];
9 years ago
}
case SCHED_STANDOFF:
{
8 years ago
return &slStandoff[0];
9 years ago
}
case SCHED_RANGE_ATTACK1:
{
8 years ago
return &slRangeAttack1[0];
9 years ago
}
case SCHED_RANGE_ATTACK2:
{
8 years ago
return &slRangeAttack2[0];
9 years ago
}
case SCHED_MELEE_ATTACK1:
{
8 years ago
return &slPrimaryMeleeAttack[0];
9 years ago
}
case SCHED_MELEE_ATTACK2:
{
8 years ago
return &slSecondaryMeleeAttack[0];
9 years ago
}
case SCHED_SPECIAL_ATTACK1:
{
8 years ago
return &slSpecialAttack1[0];
9 years ago
}
case SCHED_SPECIAL_ATTACK2:
{
8 years ago
return &slSpecialAttack2[0];
9 years ago
}
case SCHED_TAKE_COVER_FROM_BEST_SOUND:
{
8 years ago
return &slTakeCoverFromBestSound[0];
9 years ago
}
case SCHED_TAKE_COVER_FROM_ENEMY:
{
8 years ago
return &slTakeCoverFromEnemy[0];
9 years ago
}
case SCHED_COWER:
{
8 years ago
return &slCower[0];
9 years ago
}
case SCHED_AMBUSH:
{
8 years ago
return &slAmbush[0];
9 years ago
}
case SCHED_BARNACLE_VICTIM_GRAB:
{
8 years ago
return &slBarnacleVictimGrab[0];
9 years ago
}
case SCHED_BARNACLE_VICTIM_CHOMP:
{
8 years ago
return &slBarnacleVictimChomp[0];
9 years ago
}
case SCHED_INVESTIGATE_SOUND:
{
8 years ago
return &slInvestigateSound[0];
9 years ago
}
case SCHED_DIE:
{
8 years ago
return &slDie[0];
9 years ago
}
case SCHED_TAKE_COVER_FROM_ORIGIN:
{
8 years ago
return &slTakeCoverFromOrigin[0];
9 years ago
}
case SCHED_VICTORY_DANCE:
{
8 years ago
return &slVictoryDance[0];
9 years ago
}
case SCHED_FAIL:
{
return slFail;
}
default:
{
8 years ago
ALERT( at_console, "GetScheduleOfType()\nNo CASE for Schedule Type %d!\n", Type );
9 years ago
8 years ago
return &slIdleStand[0];
9 years ago
break;
}
}
return NULL;
}