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.

1250 lines
25 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 "soundent.h"
#include "nodes.h"
#include "scripted.h"
//=========================================================
// Fail
//=========================================================
8 years ago
Task_t tlFail[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT, (float)2 },
{ TASK_WAIT_PVS, (float)0 },
9 years ago
};
8 years ago
Schedule_t slFail[] =
9 years ago
{
{
tlFail,
8 years ago
ARRAYSIZE( tlFail ),
9 years ago
bits_COND_CAN_ATTACK,
0,
"Fail"
},
};
//=========================================================
// Idle Schedules
//=========================================================
8 years ago
Task_t tlIdleStand1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT, (float)5 }, // repick IDLESTAND every five seconds. gives us a chance to pick an active idle, fidget, etc.
9 years ago
};
8 years ago
Schedule_t slIdleStand[] =
9 years ago
{
8 years ago
{
9 years ago
tlIdleStand1,
8 years ago
ARRAYSIZE( tlIdleStand1 ),
bits_COND_NEW_ENEMY |
bits_COND_SEE_FEAR |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_HEAR_SOUND |
bits_COND_SMELL_FOOD |
bits_COND_SMELL |
9 years ago
bits_COND_PROVOKED,
8 years ago
bits_SOUND_COMBAT |// sound flags
bits_SOUND_WORLD |
bits_SOUND_PLAYER |
bits_SOUND_DANGER |
9 years ago
8 years ago
bits_SOUND_MEAT |// scents
bits_SOUND_CARCASS |
9 years ago
bits_SOUND_GARBAGE,
"IdleStand"
},
};
8 years ago
Schedule_t slIdleTrigger[] =
9 years ago
{
8 years ago
{
9 years ago
tlIdleStand1,
8 years ago
ARRAYSIZE( tlIdleStand1 ),
bits_COND_LIGHT_DAMAGE |
9 years ago
bits_COND_HEAVY_DAMAGE,
0,
"Idle Trigger"
},
};
8 years ago
Task_t tlIdleWalk1[] =
9 years ago
{
8 years ago
{ TASK_WALK_PATH, (float)9999 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
9 years ago
};
8 years ago
Schedule_t slIdleWalk[] =
9 years ago
{
8 years ago
{
9 years ago
tlIdleWalk1,
8 years ago
ARRAYSIZE( tlIdleWalk1 ),
bits_COND_NEW_ENEMY |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_HEAR_SOUND |
bits_COND_SMELL_FOOD |
bits_COND_SMELL |
9 years ago
bits_COND_PROVOKED,
8 years ago
bits_SOUND_COMBAT |// sound flags
9 years ago
8 years ago
bits_SOUND_MEAT |// scents
bits_SOUND_CARCASS |
9 years ago
bits_SOUND_GARBAGE,
"Idle Walk"
},
};
//=========================================================
// Ambush - monster stands in place and waits for a new
// enemy, or chance to attack an existing enemy.
//=========================================================
8 years ago
Task_t tlAmbush[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_INDEFINITE, (float)0 },
9 years ago
};
8 years ago
Schedule_t slAmbush[] =
9 years ago
{
8 years ago
{
9 years ago
tlAmbush,
8 years ago
ARRAYSIZE( tlAmbush ),
bits_COND_NEW_ENEMY |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_PROVOKED,
0,
"Ambush"
},
};
//=========================================================
// ActiveIdle schedule - !!!BUGBUG - if this schedule doesn't
// complete on its own, the monster's HintNode will not be
// cleared, and the rest of the monster's group will avoid
// that node because they think the group member that was
// previously interrupted is still using that node to active
// idle.
///=========================================================
Task_t tlActiveIdle[] =
{
8 years ago
{ TASK_FIND_HINTNODE, (float)0 },
{ TASK_GET_PATH_TO_HINTNODE, (float)0 },
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_FACE_HINTNODE, (float)0 },
{ TASK_PLAY_ACTIVE_IDLE, (float)0 },
{ TASK_GET_PATH_TO_LASTPOSITION, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_CLEAR_LASTPOSITION, (float)0 },
{ TASK_CLEAR_HINTNODE, (float)0 },
9 years ago
};
Schedule_t slActiveIdle[] =
{
{
tlActiveIdle,
ARRAYSIZE( tlActiveIdle ),
8 years ago
bits_COND_NEW_ENEMY |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_PROVOKED |
9 years ago
bits_COND_HEAR_SOUND,
8 years ago
bits_SOUND_COMBAT |
bits_SOUND_WORLD |
bits_SOUND_PLAYER |
9 years ago
bits_SOUND_DANGER,
"Active Idle"
}
};
//=========================================================
// Wake Schedules
//=========================================================
Task_t tlWakeAngry1[] =
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_SOUND_WAKE, (float)0 },
{ TASK_FACE_IDEAL, (float)0 },
9 years ago
};
Schedule_t slWakeAngry[] =
{
{
tlWakeAngry1,
8 years ago
ARRAYSIZE( tlWakeAngry1 ),
9 years ago
0,
0,
"Wake Angry"
}
};
//=========================================================
// AlertFace Schedules
//=========================================================
8 years ago
Task_t tlAlertFace1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_FACE_IDEAL, (float)0 },
9 years ago
};
8 years ago
Schedule_t slAlertFace[] =
9 years ago
{
8 years ago
{
9 years ago
tlAlertFace1,
8 years ago
ARRAYSIZE( tlAlertFace1 ),
bits_COND_NEW_ENEMY |
bits_COND_SEE_FEAR |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_PROVOKED,
0,
"Alert Face"
},
};
//=========================================================
// AlertSmallFlinch Schedule - shot, but didn't see attacker,
// flinch then face
//=========================================================
8 years ago
Task_t tlAlertSmallFlinch[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_REMEMBER, (float)bits_MEMORY_FLINCHED },
{ TASK_SMALL_FLINCH, (float)0 },
{ TASK_SET_SCHEDULE, (float)SCHED_ALERT_FACE },
9 years ago
};
8 years ago
Schedule_t slAlertSmallFlinch[] =
9 years ago
{
8 years ago
{
9 years ago
tlAlertSmallFlinch,
8 years ago
ARRAYSIZE( tlAlertSmallFlinch ),
9 years ago
0,
0,
"Alert Small Flinch"
},
};
//=========================================================
// AlertIdle Schedules
//=========================================================
8 years ago
Task_t tlAlertStand1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT, (float)20 },
{ TASK_SUGGEST_STATE, (float)MONSTERSTATE_IDLE },
9 years ago
};
8 years ago
Schedule_t slAlertStand[] =
9 years ago
{
8 years ago
{
9 years ago
tlAlertStand1,
8 years ago
ARRAYSIZE( tlAlertStand1 ),
bits_COND_NEW_ENEMY |
bits_COND_SEE_ENEMY |
bits_COND_SEE_FEAR |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_PROVOKED |
bits_COND_SMELL |
bits_COND_SMELL_FOOD |
9 years ago
bits_COND_HEAR_SOUND,
8 years ago
bits_SOUND_COMBAT |// sound flags
bits_SOUND_WORLD |
bits_SOUND_PLAYER |
bits_SOUND_DANGER |
bits_SOUND_MEAT |// scent flags
bits_SOUND_CARCASS |
9 years ago
bits_SOUND_GARBAGE,
"Alert Stand"
},
};
//=========================================================
// InvestigateSound - sends a monster to the location of the
// sound that was just heard, to check things out.
//=========================================================
Task_t tlInvestigateSound[] =
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_GET_PATH_TO_BESTSOUND, (float)0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_IDLE },
{ TASK_WAIT, (float)10 },
{ TASK_GET_PATH_TO_LASTPOSITION,(float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_CLEAR_LASTPOSITION, (float)0 },
9 years ago
};
8 years ago
Schedule_t slInvestigateSound[] =
9 years ago
{
8 years ago
{
9 years ago
tlInvestigateSound,
8 years ago
ARRAYSIZE( tlInvestigateSound ),
bits_COND_NEW_ENEMY |
bits_COND_SEE_FEAR |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"InvestigateSound"
},
};
//=========================================================
// CombatIdle Schedule
//=========================================================
8 years ago
Task_t tlCombatStand1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_INDEFINITE, (float)0 },
9 years ago
};
8 years ago
Schedule_t slCombatStand[] =
9 years ago
{
8 years ago
{
9 years ago
tlCombatStand1,
8 years ago
ARRAYSIZE( tlCombatStand1 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_CAN_ATTACK,
0,
"Combat Stand"
},
};
//=========================================================
// CombatFace Schedule
//=========================================================
8 years ago
Task_t tlCombatFace1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_FACE_ENEMY, (float)0 },
9 years ago
};
8 years ago
Schedule_t slCombatFace[] =
9 years ago
{
{
tlCombatFace1,
8 years ago
ARRAYSIZE( tlCombatFace1 ),
bits_COND_CAN_ATTACK |
bits_COND_NEW_ENEMY |
9 years ago
bits_COND_ENEMY_DEAD,
0,
"Combat Face"
},
};
//=========================================================
// Standoff schedule. Used in combat when a monster is
// hiding in cover or the enemy has moved out of sight.
// Should we look around in this schedule?
//=========================================================
8 years ago
Task_t tlStandoff[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_FACE_ENEMY, (float)2 },
9 years ago
};
Schedule_t slStandoff[] =
{
{
tlStandoff,
8 years ago
ARRAYSIZE( tlStandoff ),
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_RANGE_ATTACK2 |
bits_COND_ENEMY_DEAD |
bits_COND_NEW_ENEMY |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Standoff"
}
};
//=========================================================
// Arm weapon (draw gun)
//=========================================================
Task_t tlArmWeapon[] =
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_ARM }
9 years ago
};
8 years ago
Schedule_t slArmWeapon[] =
9 years ago
{
{
tlArmWeapon,
8 years ago
ARRAYSIZE( tlArmWeapon ),
9 years ago
0,
0,
"Arm Weapon"
}
};
//=========================================================
// reload schedule
//=========================================================
Task_t tlReload[] =
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, float(ACT_RELOAD) },
9 years ago
};
8 years ago
Schedule_t slReload[] =
9 years ago
{
{
tlReload,
8 years ago
ARRAYSIZE( tlReload ),
9 years ago
bits_COND_HEAVY_DAMAGE,
0,
"Reload"
}
};
//=========================================================
// Attack Schedules
//=========================================================
// primary range attack
8 years ago
Task_t tlRangeAttack1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_RANGE_ATTACK1, (float)0 },
9 years ago
};
8 years ago
Schedule_t slRangeAttack1[] =
9 years ago
{
8 years ago
{
9 years ago
tlRangeAttack1,
8 years ago
ARRAYSIZE( tlRangeAttack1 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Range Attack1"
},
};
// secondary range attack
8 years ago
Task_t tlRangeAttack2[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_RANGE_ATTACK2, (float)0 },
9 years ago
};
8 years ago
Schedule_t slRangeAttack2[] =
9 years ago
{
8 years ago
{
9 years ago
tlRangeAttack2,
8 years ago
ARRAYSIZE( tlRangeAttack2 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Range Attack2"
},
};
// primary melee attack
8 years ago
Task_t tlPrimaryMeleeAttack1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_MELEE_ATTACK1, (float)0 },
9 years ago
};
8 years ago
Schedule_t slPrimaryMeleeAttack[] =
9 years ago
{
8 years ago
{
9 years ago
tlPrimaryMeleeAttack1,
8 years ago
ARRAYSIZE( tlPrimaryMeleeAttack1 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_ENEMY_OCCLUDED,
0,
"Primary Melee Attack"
},
};
// secondary melee attack
8 years ago
Task_t tlSecondaryMeleeAttack1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_MELEE_ATTACK2, (float)0},
9 years ago
};
8 years ago
Schedule_t slSecondaryMeleeAttack[] =
9 years ago
{
8 years ago
{
9 years ago
tlSecondaryMeleeAttack1,
8 years ago
ARRAYSIZE( tlSecondaryMeleeAttack1 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
9 years ago
bits_COND_ENEMY_OCCLUDED,
0,
"Secondary Melee Attack"
},
};
// special attack1
8 years ago
Task_t tlSpecialAttack1[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_SPECIAL_ATTACK1, (float)0 },
9 years ago
};
8 years ago
Schedule_t slSpecialAttack1[] =
9 years ago
{
8 years ago
{
9 years ago
tlSpecialAttack1,
8 years ago
ARRAYSIZE( tlSpecialAttack1 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Special Attack1"
},
};
// special attack2
8 years ago
Task_t tlSpecialAttack2[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_SPECIAL_ATTACK2, (float)0 },
9 years ago
};
8 years ago
Schedule_t slSpecialAttack2[] =
9 years ago
{
8 years ago
{
9 years ago
tlSpecialAttack2,
8 years ago
ARRAYSIZE( tlSpecialAttack2 ),
bits_COND_NEW_ENEMY |
bits_COND_ENEMY_DEAD |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE |
bits_COND_ENEMY_OCCLUDED |
bits_COND_NO_AMMO_LOADED |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Special Attack2"
},
};
// Chase enemy schedule
8 years ago
Task_t tlChaseEnemy1[] =
9 years ago
{
8 years ago
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_CHASE_ENEMY_FAILED },
{ TASK_GET_PATH_TO_ENEMY, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
9 years ago
};
Schedule_t slChaseEnemy[] =
{
8 years ago
{
9 years ago
tlChaseEnemy1,
8 years ago
ARRAYSIZE( tlChaseEnemy1 ),
bits_COND_NEW_ENEMY |
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_MELEE_ATTACK1 |
bits_COND_CAN_RANGE_ATTACK2 |
bits_COND_CAN_MELEE_ATTACK2 |
bits_COND_TASK_FAILED |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"Chase Enemy"
},
};
// Chase enemy failure schedule
8 years ago
Task_t tlChaseEnemyFailed[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_WAIT, (float)0.2 },
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_REMEMBER, (float)bits_MEMORY_INCOVER },
//{ TASK_TURN_LEFT, (float)179 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_WAIT, (float)1 },
9 years ago
};
8 years ago
Schedule_t slChaseEnemyFailed[] =
9 years ago
{
8 years ago
{
9 years ago
tlChaseEnemyFailed,
8 years ago
ARRAYSIZE( tlChaseEnemyFailed ),
bits_COND_NEW_ENEMY |
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_MELEE_ATTACK1 |
bits_COND_CAN_RANGE_ATTACK2 |
bits_COND_CAN_MELEE_ATTACK2 |
9 years ago
bits_COND_HEAR_SOUND,
bits_SOUND_DANGER,
"tlChaseEnemyFailed"
},
};
//=========================================================
// small flinch, played when minor damage is taken.
//=========================================================
Task_t tlSmallFlinch[] =
{
8 years ago
{ TASK_REMEMBER, (float)bits_MEMORY_FLINCHED },
{ TASK_STOP_MOVING, 0 },
{ TASK_SMALL_FLINCH, 0 },
9 years ago
};
Schedule_t slSmallFlinch[] =
{
{
tlSmallFlinch,
8 years ago
ARRAYSIZE( tlSmallFlinch ),
9 years ago
0,
0,
"Small Flinch"
},
};
//=========================================================
// Die!
//=========================================================
Task_t tlDie1[] =
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_SOUND_DIE, (float)0 },
{ TASK_DIE, (float)0 },
9 years ago
};
Schedule_t slDie[] =
{
{
tlDie1,
ARRAYSIZE( tlDie1 ),
0,
0,
"Die"
},
};
//=========================================================
// Victory Dance
//=========================================================
Task_t tlVictoryDance[] =
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE },
{ TASK_WAIT, (float)0 },
9 years ago
};
Schedule_t slVictoryDance[] =
{
{
tlVictoryDance,
ARRAYSIZE( tlVictoryDance ),
0,
0,
"Victory Dance"
},
};
//=========================================================
// BarnacleVictimGrab - barnacle tongue just hit the monster,
// so play a hit animation, then play a cycling pull animation
// as the creature is hoisting the monster.
//=========================================================
8 years ago
Task_t tlBarnacleVictimGrab[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_BARNACLE_HIT },
{ TASK_SET_ACTIVITY, (float)ACT_BARNACLE_PULL },
{ TASK_WAIT_INDEFINITE, (float)0 },// just cycle barnacle pull anim while barnacle hoists.
9 years ago
};
Schedule_t slBarnacleVictimGrab[] =
{
{
tlBarnacleVictimGrab,
8 years ago
ARRAYSIZE( tlBarnacleVictimGrab ),
9 years ago
0,
0,
"Barnacle Victim"
}
};
//=========================================================
// BarnacleVictimChomp - barnacle has pulled the prey to its
// mouth. Victim should play the BARNCLE_CHOMP animation
// once, then loop the BARNACLE_CHEW animation indefinitely
//=========================================================
8 years ago
Task_t tlBarnacleVictimChomp[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_BARNACLE_CHOMP },
{ TASK_SET_ACTIVITY, (float)ACT_BARNACLE_CHEW },
{ TASK_WAIT_INDEFINITE, (float)0 },// just cycle barnacle pull anim while barnacle hoists.
9 years ago
};
Schedule_t slBarnacleVictimChomp[] =
{
{
tlBarnacleVictimChomp,
8 years ago
ARRAYSIZE( tlBarnacleVictimChomp ),
9 years ago
0,
0,
"Barnacle Chomp"
}
};
8 years ago
// Universal Error Schedule
Task_t tlError[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_WAIT_INDEFINITE, (float)0 },
9 years ago
};
8 years ago
Schedule_t slError[] =
9 years ago
{
8 years ago
{
9 years ago
tlError,
8 years ago
ARRAYSIZE( tlError ),
9 years ago
0,
0,
"Error"
},
};
8 years ago
Task_t tlScriptedWalk[] =
9 years ago
{
8 years ago
{ TASK_WALK_TO_TARGET, (float)TARGET_MOVE_SCRIPTED },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_PLANT_ON_SCRIPT, (float)0 },
{ TASK_FACE_SCRIPT, (float)0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_ENABLE_SCRIPT, (float)0 },
{ TASK_WAIT_FOR_SCRIPT, (float)0 },
{ TASK_PLAY_SCRIPT, (float)0 },
9 years ago
};
Schedule_t slWalkToScript[] =
{
8 years ago
{
9 years ago
tlScriptedWalk,
8 years ago
ARRAYSIZE( tlScriptedWalk ),
9 years ago
SCRIPT_BREAK_CONDITIONS,
0,
"WalkToScript"
},
};
8 years ago
Task_t tlScriptedRun[] =
9 years ago
{
8 years ago
{ TASK_RUN_TO_TARGET, (float)TARGET_MOVE_SCRIPTED },
{ TASK_WAIT_FOR_MOVEMENT,(float)0 },
{ TASK_PLANT_ON_SCRIPT, (float)0 },
{ TASK_FACE_SCRIPT, (float)0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_ENABLE_SCRIPT, (float)0 },
{ TASK_WAIT_FOR_SCRIPT, (float)0 },
{ TASK_PLAY_SCRIPT, (float)0 },
9 years ago
};
Schedule_t slRunToScript[] =
{
8 years ago
{
9 years ago
tlScriptedRun,
8 years ago
ARRAYSIZE( tlScriptedRun ),
9 years ago
SCRIPT_BREAK_CONDITIONS,
0,
"RunToScript"
},
};
8 years ago
Task_t tlScriptedWait[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_WAIT_FOR_SCRIPT, (float)0 },
{ TASK_PLAY_SCRIPT, (float)0 },
9 years ago
};
Schedule_t slWaitScript[] =
{
8 years ago
{
9 years ago
tlScriptedWait,
8 years ago
ARRAYSIZE( tlScriptedWait ),
9 years ago
SCRIPT_BREAK_CONDITIONS,
0,
"WaitForScript"
},
};
8 years ago
Task_t tlScriptedFace[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_SCRIPT, (float)0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_WAIT_FOR_SCRIPT, (float)0 },
{ TASK_PLAY_SCRIPT, (float)0 },
9 years ago
};
Schedule_t slFaceScript[] =
{
8 years ago
{
9 years ago
tlScriptedFace,
8 years ago
ARRAYSIZE( tlScriptedFace ),
9 years ago
SCRIPT_BREAK_CONDITIONS,
0,
"FaceScript"
},
};
//=========================================================
// Cower - this is what is usually done when attempts
// to escape danger fail.
//=========================================================
8 years ago
Task_t tlCower[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, 0 },
{ TASK_PLAY_SEQUENCE, (float)ACT_COWER },
9 years ago
};
8 years ago
Schedule_t slCower[] =
9 years ago
{
{
tlCower,
8 years ago
ARRAYSIZE( tlCower ),
9 years ago
0,
0,
"Cower"
},
};
//=========================================================
// move away from where you're currently standing.
//=========================================================
8 years ago
Task_t tlTakeCoverFromOrigin[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FIND_COVER_FROM_ORIGIN, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_REMEMBER, (float)bits_MEMORY_INCOVER },
{ TASK_TURN_LEFT, (float)179 },
9 years ago
};
8 years ago
Schedule_t slTakeCoverFromOrigin[] =
9 years ago
{
8 years ago
{
9 years ago
tlTakeCoverFromOrigin,
8 years ago
ARRAYSIZE( tlTakeCoverFromOrigin ),
9 years ago
bits_COND_NEW_ENEMY,
0,
"TakeCoverFromOrigin"
},
};
// modif de Julien
//=========================================================
// slBurnt - monstre victime du lance-flammes
//=========================================================
Task_t tlBurnt[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_TAKE_COVER_FROM_ORIGIN },
{ TASK_STOP_MOVING, (float)0 },
{ TASK_GET_BURNT_COVER, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
};
Schedule_t slBurnt[] =
{
{
tlBurnt,
ARRAYSIZE ( tlBurnt ),
0,
0,
"Monster burnt"
},
};
9 years ago
//=========================================================
// hide from the loudest sound source
//=========================================================
8 years ago
Task_t tlTakeCoverFromBestSound[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FIND_COVER_FROM_BEST_SOUND, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_REMEMBER, (float)bits_MEMORY_INCOVER },
{ TASK_TURN_LEFT, (float)179 },
9 years ago
};
8 years ago
Schedule_t slTakeCoverFromBestSound[] =
9 years ago
{
8 years ago
{
9 years ago
tlTakeCoverFromBestSound,
8 years ago
ARRAYSIZE( tlTakeCoverFromBestSound ),
9 years ago
bits_COND_NEW_ENEMY,
0,
"TakeCoverFromBestSound"
},
};
//=========================================================
// Take cover from enemy! Tries lateral cover before node
// cover!
//=========================================================
8 years ago
Task_t tlTakeCoverFromEnemy[] =
9 years ago
{
8 years ago
{ TASK_STOP_MOVING, (float)0 },
{ TASK_WAIT, (float)0.2 },
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_REMEMBER, (float)bits_MEMORY_INCOVER },
//{ TASK_TURN_LEFT, (float)179 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_WAIT, (float)1 },
9 years ago
};
8 years ago
Schedule_t slTakeCoverFromEnemy[] =
9 years ago
{
8 years ago
{
9 years ago
tlTakeCoverFromEnemy,
8 years ago
ARRAYSIZE( tlTakeCoverFromEnemy ),
9 years ago
bits_COND_NEW_ENEMY,
0,
"tlTakeCoverFromEnemy"
},
};
8 years ago
Schedule_t *CBaseMonster::m_scheduleList[] =
9 years ago
{
slIdleStand,
slIdleTrigger,
slIdleWalk,
slAmbush,
slActiveIdle,
slWakeAngry,
slAlertFace,
slAlertSmallFlinch,
slAlertStand,
slInvestigateSound,
slCombatStand,
slCombatFace,
slStandoff,
slArmWeapon,
slReload,
slRangeAttack1,
slRangeAttack2,
slPrimaryMeleeAttack,
slSecondaryMeleeAttack,
slSpecialAttack1,
slSpecialAttack2,
slChaseEnemy,
slChaseEnemyFailed,
slSmallFlinch,
slDie,
slVictoryDance,
slBarnacleVictimGrab,
slBarnacleVictimChomp,
slError,
slWalkToScript,
slRunToScript,
slWaitScript,
slFaceScript,
slCower,
slTakeCoverFromOrigin,
// modif de Julien
slBurnt,
9 years ago
slTakeCoverFromBestSound,
slTakeCoverFromEnemy,
slFail
};
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;
}
// modif de Julien
case SCHED_BURNT:
{
return &slBurnt[ 0 ];
}
9 years ago
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;
}