Skip to content

Commit

Permalink
update monster ai descriptions
Browse files Browse the repository at this point in the history
use a common schedule naming scheme, and add the missing task name methods. Also added IsNormalMonster() to narrow down monsters to the ones that think using the base ai.
  • Loading branch information
wootguy committed Nov 6, 2024
1 parent 42c4b2e commit 8464a1c
Show file tree
Hide file tree
Showing 35 changed files with 351 additions and 207 deletions.
1 change: 1 addition & 0 deletions cl_dll/hl/hl_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ const char* CBaseMonster::GetTaskName(int taskIdx) {return "";}
const char* CBaseMonster::DisplayName() {return "";}
BOOL CBaseMonster::IsMachine() {return 0;}
void CBaseMonster::Precache() {}
void CBaseMonster::GetAllSchedules(std::unordered_set<Schedule_t*>& schedulesOut) {}

int TrainSpeed(int iSpeed, int iMax) { return 0; }
void CBasePlayer :: DeathSound( void ) { }
Expand Down
1 change: 1 addition & 0 deletions dlls/CBasePlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class EXPORT CBasePlayer : public CBaseMonster
int IsObserver() { return m_isObserver; };
BOOL IsFirstPerson() { return m_hViewEntity.GetEdict() == edict(); }
BOOL IsBot() { return pev->flags & FL_FAKECLIENT; }
virtual BOOL IsNormalMonster(void) { return FALSE; }
virtual int GetEntindexPriority() { return ENTIDX_PRIORITY_HIGH; }

int random_seed; // See that is shared between client & server for shared weapons code
Expand Down
1 change: 1 addition & 0 deletions dlls/cbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class EXPORT CBaseEntity
virtual BOOL HasTarget( string_t targetname ) { return FStrEq(STRING(targetname), STRING(pev->target) ); }
virtual BOOL IsInWorld( void );
virtual BOOL IsMonster( void ) { return FALSE; }
virtual BOOL IsNormalMonster(void) { return FALSE; } // is this what you'd expect to be a monster? (not a monstermaker/grenade/etc.)
virtual BOOL IsPlayer( void ) { return FALSE; }
virtual BOOL IsPlayerCorpse( void ) { return FALSE; }
virtual BOOL IsNetClient( void ) { return FALSE; }
Expand Down
28 changes: 19 additions & 9 deletions dlls/monster/CAGrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ Schedule_t slAGruntFail[] =
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_MELEE_ATTACK1,
0,
"AGrunt Fail"
"AGRUNT_FAIL"
},
};

Expand All @@ -632,7 +632,7 @@ Schedule_t slAGruntCombatFail[] =
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_MELEE_ATTACK1,
0,
"AGrunt Combat Fail"
"AGRUNT_COMBAT_FAIL"
},
};

Expand Down Expand Up @@ -660,7 +660,7 @@ Schedule_t slAGruntStandoff[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"Agrunt Standoff"
"AGRUNT_STANDOFF"
}
};

Expand All @@ -680,7 +680,7 @@ Schedule_t slAGruntSuppress[] =
ARRAYSIZE ( tlAGruntSuppressHornet ),
0,
0,
"AGrunt Suppress Hornet",
"AGRUNT_SUPPRESS_HORNET",
},
};

Expand All @@ -704,7 +704,7 @@ Schedule_t slAGruntRangeAttack1[] =
bits_COND_HEAVY_DAMAGE,

0,
"AGrunt Range Attack1"
"AGRUNT_RANGE_ATTACK1"
},
};

Expand All @@ -718,6 +718,7 @@ Task_t tlAGruntHiddenRangeAttack1[] =
{ TASK_RANGE_ATTACK1_NOTURN, (float)0 },
};


Schedule_t slAGruntHiddenRangeAttack[] =
{
{
Expand All @@ -728,7 +729,7 @@ Schedule_t slAGruntHiddenRangeAttack[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"AGrunt Hidden Range Attack1"
"AGRUNT_HIDDEN_RANGE_ATTACK"
},
};

Expand All @@ -754,7 +755,7 @@ Schedule_t slAGruntTakeCoverFromEnemy[] =
ARRAYSIZE ( tlAGruntTakeCoverFromEnemy ),
bits_COND_NEW_ENEMY,
0,
"AGruntTakeCoverFromEnemy"
"AGRUNT_TAKE_COVER_FROM_ENEMY"
},
};

Expand Down Expand Up @@ -793,7 +794,7 @@ Schedule_t slAGruntVictoryDance[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE,
0,
"AGruntVictoryDance"
"AGRUNT_VICTORY_DANCE"
},
};

Expand All @@ -818,7 +819,7 @@ Schedule_t slAGruntThreatDisplay[] =
bits_SOUND_PLAYER |
bits_SOUND_COMBAT |
bits_SOUND_WORLD,
"AGruntThreatDisplay"
"AGRUNT_THREAT_DISPLAY"
},
};

Expand Down Expand Up @@ -1142,6 +1143,15 @@ Schedule_t* CAGrunt :: GetScheduleOfType ( int Type )
return CTalkSquadMonster :: GetScheduleOfType( Type );
}

const char* CAGrunt::GetTaskName(int taskIdx) {
switch (taskIdx) {
case TASK_AGRUNT_SETUP_HIDE_ATTACK: return "TASK_AGRUNT_SETUP_HIDE_ATTACK";
case TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE: return "TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE";
default:
return CTalkSquadMonster::GetTaskName(taskIdx);
}
}

void CAGrunt::StartFollowingSound() {
StopTalking();
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pAlertSounds), 1.0, ATTN_NORM);
Expand Down
1 change: 1 addition & 0 deletions dlls/monster/CAGrunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class CAGrunt : public CTalkSquadMonster

Schedule_t* GetSchedule(void);
Schedule_t* GetScheduleOfType(int Type);
const char* GetTaskName(int taskIdx);
BOOL FCanCheckAttacks(void);
BOOL CheckMeleeAttack1(float flDot, float flDist);
BOOL CheckRangeAttack1(float flDot, float flDist);
Expand Down
8 changes: 4 additions & 4 deletions dlls/monster/CBarney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Schedule_t slBaFollow[] =
bits_COND_HEAR_SOUND |
bits_COND_PROVOKED,
bits_SOUND_DANGER,
"Follow"
"BARNEY_FOLLOW"
},
};

Expand All @@ -162,7 +162,7 @@ Schedule_t slBarneyEnemyDraw[] =
ARRAYSIZE ( tlBarneyEnemyDraw ),
0,
0,
"Barney Enemy Draw"
"BARNEY_ENEMY_DRAW"
}
};

Expand All @@ -186,7 +186,7 @@ Schedule_t slBaFaceTarget[] =
bits_COND_HEAR_SOUND |
bits_COND_PROVOKED,
bits_SOUND_DANGER,
"FaceTarget"
"BARNEY_FACE_TARGET"
},
};

Expand Down Expand Up @@ -219,7 +219,7 @@ Schedule_t slIdleBaStand[] =
bits_SOUND_MEAT |// scents
bits_SOUND_CARCASS |
bits_SOUND_GARBAGE,
"IdleStand"
"BARNEY_IDLE_STAND"
},
};

Expand Down
48 changes: 24 additions & 24 deletions dlls/monster/CBaseGrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ Schedule_t slGruntFail[] =
bits_COND_CAN_MELEE_ATTACK1 |
bits_COND_CAN_MELEE_ATTACK2,
0,
"Grunt Fail"
"GRUNT_FAIL"
},
};

Expand Down Expand Up @@ -1219,7 +1219,7 @@ Schedule_t slGruntCombatFail[] =
bits_SOUND_COMBAT |// sound flags
bits_SOUND_PLAYER |
bits_SOUND_DANGER,
"Grunt Combat Fail"
"GRUNT_COMBAT_FAIL"
},
};

Expand Down Expand Up @@ -1247,7 +1247,7 @@ Schedule_t slGruntVictoryDance[] =
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE,
0,
"GruntVictoryDance"
"GRUNT_VICTORY_DANCE"
},
};

Expand Down Expand Up @@ -1278,7 +1278,7 @@ Schedule_t slGruntEstablishLineOfFire[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"GruntEstablishLineOfFire"
"GRUNT_ESTABLISH_LINE_OF_FIRE"
},
};

Expand All @@ -1301,7 +1301,7 @@ Schedule_t slGruntFoundEnemy[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"GruntFoundEnemy"
"GRUNT_FOUND_ENEMY"
},
};

Expand All @@ -1327,7 +1327,7 @@ Schedule_t slGruntCombatFace[] =
bits_COND_CAN_RANGE_ATTACK1 |
bits_COND_CAN_RANGE_ATTACK2,
0,
"Combat Face"
"GRUNT_COMBAT_FACE"
},
};

Expand Down Expand Up @@ -1370,7 +1370,7 @@ Schedule_t slGruntSignalSuppress[] =
bits_COND_NO_AMMO_LOADED,

bits_SOUND_DANGER,
"SignalSuppress"
"GRUNT_SIGNAL_SUPPRESS"
},
};

Expand Down Expand Up @@ -1407,7 +1407,7 @@ Schedule_t slGruntSuppress[] =
bits_COND_NO_AMMO_LOADED,

bits_SOUND_DANGER,
"Suppress"
"GRUNT_SUPPRESS"
},
};

Expand Down Expand Up @@ -1437,7 +1437,7 @@ Schedule_t slGruntWaitInCover[] =
bits_COND_CAN_MELEE_ATTACK2,

bits_SOUND_DANGER,
"GruntWaitInCover"
"GRUNT_WAIT_IN_COVER"
},
};

Expand Down Expand Up @@ -1465,7 +1465,7 @@ Schedule_t slGruntTakeCover[] =
ARRAYSIZE ( tlGruntTakeCover1 ),
0,
0,
"TakeCover"
"GRUNT_TAKE_COVER"
},
};

Expand All @@ -1491,7 +1491,7 @@ Schedule_t slGruntGrenadeCover[] =
ARRAYSIZE ( tlGruntGrenadeCover1 ),
0,
0,
"GrenadeCover"
"GRUNT_GRENADE_COVER"
},
};

Expand All @@ -1513,7 +1513,7 @@ Schedule_t slGruntTossGrenadeCover[] =
ARRAYSIZE ( tlGruntTossGrenadeCover1 ),
0,
0,
"TossGrenadeCover"
"GRUNT_TOSS_GRENADE_COVER"
},
};

Expand All @@ -1538,7 +1538,7 @@ Schedule_t slGruntTakeCoverFromBestSound[] =
ARRAYSIZE ( tlGruntTakeCoverFromBestSound ),
0,
0,
"GruntTakeCoverFromBestSound"
"GRUNT_TAKE_COVER_FROM_BEST_SOUND"
},
};

Expand Down Expand Up @@ -1566,7 +1566,7 @@ Schedule_t slGruntHideReload[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"GruntHideReload"
"GRUNT_HIDE_RELOAD"
}
};

Expand Down Expand Up @@ -1598,7 +1598,7 @@ Schedule_t slGruntSweep[] =
bits_SOUND_DANGER |
bits_SOUND_PLAYER,

"Grunt Sweep"
"GRUNT_SWEEP"
},
};

Expand Down Expand Up @@ -1637,7 +1637,7 @@ Schedule_t slGruntRangeAttack1A[] =
bits_COND_NO_AMMO_LOADED,

bits_SOUND_DANGER,
"Range Attack1A"
"GRUNT_RANGE_ATTACK_1A"
},
};

Expand Down Expand Up @@ -1674,7 +1674,7 @@ Schedule_t slGruntRangeAttack1B[] =
bits_COND_HEAR_SOUND,

bits_SOUND_DANGER,
"Range Attack1B"
"GRUNT_RANGE_ATTACK_1B"
},
};

Expand Down Expand Up @@ -1710,7 +1710,7 @@ Schedule_t slGruntRangeAttack1C[] =
bits_COND_NO_AMMO_LOADED,

bits_SOUND_DANGER,
"Range Attack"
"GRUNT_RANGE_ATTACK_1C"
},
};

Expand All @@ -1733,7 +1733,7 @@ Schedule_t slGruntRangeAttack2[] =
ARRAYSIZE ( tlGruntRangeAttack2 ),
0,
0,
"RangeAttack2"
"GRUNT_RANGE_ATTACK2"
},
};

Expand Down Expand Up @@ -1762,7 +1762,7 @@ Schedule_t slGruntRepel[] =
bits_SOUND_DANGER |
bits_SOUND_COMBAT |
bits_SOUND_PLAYER,
"Repel"
"GRUNT_REPEL"
},
};

Expand All @@ -1784,7 +1784,7 @@ Schedule_t slGruntRepelAttack[] =
ARRAYSIZE ( tlGruntRepelAttack ),
bits_COND_ENEMY_OCCLUDED,
0,
"Repel Attack"
"GRUNT_REPEL_ATTACK"
},
};

Expand Down Expand Up @@ -1815,7 +1815,7 @@ Schedule_t slGruntRepelLand[] =
bits_SOUND_DANGER |
bits_SOUND_COMBAT |
bits_SOUND_PLAYER,
"Repel Land"
"GRUNT_REPEL_LAND"
},
};

Expand All @@ -1838,7 +1838,7 @@ Schedule_t slMinigunSpinup[] =
bits_COND_GRUNT_NOFIRE,

0,
"Minigun spinup"
"GRUNT_MINIGUN_SPINUP"
},
};

Expand All @@ -1855,7 +1855,7 @@ Schedule_t slMinigunSpindown[] =
0,

0,
"Minigun spindown"
"GRUNT_MINIGUN_SPINDOWN"
},
};

Expand Down
Loading

0 comments on commit 8464a1c

Please sign in to comment.