mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-29 06:07:57 +03:00
Added AI_EVENT_BADPLACE
This commit is contained in:
parent
7a2311d6e6
commit
1e94cdd8ca
2 changed files with 67 additions and 60 deletions
|
@ -5581,9 +5581,7 @@ Default pain handler.
|
|||
*/
|
||||
void Actor::DefaultPain(Event *ev)
|
||||
{
|
||||
gi.Printf("DefaultPain event");
|
||||
SetThink(THINKSTATE_PAIN, THINK_PAIN);
|
||||
|
||||
HandlePain(ev);
|
||||
}
|
||||
|
||||
|
@ -5660,9 +5658,7 @@ Default killed handler.
|
|||
void Actor::DefaultKilled(Event *ev, bool bPlayDeathAnim)
|
||||
{
|
||||
ClearStates();
|
||||
|
||||
SetThink(THINKSTATE_KILLED, THINK_KILLED);
|
||||
|
||||
HandleKilled(ev, bPlayDeathAnim);
|
||||
}
|
||||
|
||||
|
@ -9363,51 +9359,59 @@ void Actor::DefaultReceiveAIEvent(
|
|||
vec3_t event_origin, int iType, Entity *originator, float fDistSquared, float fMaxDistSquared
|
||||
)
|
||||
{
|
||||
if (!IsDead()) {
|
||||
if (!originator->IsDead() && originator->IsSubclassOfSentient() && ((Sentient *)originator)->m_Team == m_Team
|
||||
&& !IsSquadMate((Sentient *)originator)) {
|
||||
MergeWithSquad((Sentient *)originator);
|
||||
}
|
||||
if (IsDead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (iType) {
|
||||
case AI_EVENT_WEAPON_FIRE:
|
||||
case AI_EVENT_WEAPON_IMPACT:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
WeaponSound(iType, event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_EXPLOSION:
|
||||
case AI_EVENT_MISC:
|
||||
case AI_EVENT_MISC_LOUD:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
CuriousSound(iType, event_origin, fDistSquared, fMaxDistSquared);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_AMERICAN_VOICE:
|
||||
case AI_EVENT_GERMAN_VOICE:
|
||||
case AI_EVENT_AMERICAN_URGENT:
|
||||
case AI_EVENT_GERMAN_URGENT:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
VoiceSound(iType, event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_FOOTSTEP:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
FootstepSound(event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_GRENADE:
|
||||
GrenadeNotification(originator);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
char assertStr[16317] = {0};
|
||||
strcpy(assertStr, "\"unknown ai_event type\"\n\tMessage: ");
|
||||
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("iType = %i", iType));
|
||||
assert(false && assertStr);
|
||||
}
|
||||
break;
|
||||
if (originator
|
||||
&& !originator->IsDead()
|
||||
&& originator->IsSubclassOfSentient()
|
||||
&& ((Sentient*)originator)->m_Team == m_Team
|
||||
&& !IsSquadMate((Sentient*)originator)) {
|
||||
MergeWithSquad((Sentient*)originator);
|
||||
}
|
||||
|
||||
switch (iType) {
|
||||
case AI_EVENT_WEAPON_FIRE:
|
||||
case AI_EVENT_WEAPON_IMPACT:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
WeaponSound(iType, event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_EXPLOSION:
|
||||
case AI_EVENT_MISC:
|
||||
case AI_EVENT_MISC_LOUD:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
CuriousSound(iType, event_origin, fDistSquared, fMaxDistSquared);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_AMERICAN_VOICE:
|
||||
case AI_EVENT_GERMAN_VOICE:
|
||||
case AI_EVENT_AMERICAN_URGENT:
|
||||
case AI_EVENT_GERMAN_URGENT:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
VoiceSound(iType, event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_FOOTSTEP:
|
||||
if (Square(m_fHearing) > fDistSquared) {
|
||||
FootstepSound(event_origin, fDistSquared, fMaxDistSquared, originator);
|
||||
}
|
||||
break;
|
||||
case AI_EVENT_GRENADE:
|
||||
GrenadeNotification(originator);
|
||||
break;
|
||||
case AI_EVENT_BADPLACE:
|
||||
UpdateBadPlaces();
|
||||
break;
|
||||
default:
|
||||
{
|
||||
char assertStr[16317] = { 0 };
|
||||
strcpy(assertStr, "\"unknown ai_event type\"\n\tMessage: ");
|
||||
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("iType = %i", iType));
|
||||
assert(false && assertStr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -334,19 +334,6 @@ enum eThinkState {
|
|||
NUM_THINKSTATES,
|
||||
};
|
||||
|
||||
#define AI_EVENT_NONE 0
|
||||
#define AI_EVENT_WEAPON_FIRE 1
|
||||
#define AI_EVENT_WEAPON_IMPACT 2
|
||||
#define AI_EVENT_EXPLOSION 3
|
||||
#define AI_EVENT_AMERICAN_VOICE 4
|
||||
#define AI_EVENT_GERMAN_VOICE 5
|
||||
#define AI_EVENT_AMERICAN_URGENT 6
|
||||
#define AI_EVENT_GERMAN_URGENT 7
|
||||
#define AI_EVENT_MISC 8
|
||||
#define AI_EVENT_MISC_LOUD 9
|
||||
#define AI_EVENT_FOOTSTEP 10
|
||||
#define AI_EVENT_GRENADE 11
|
||||
|
||||
enum eThinkNum {
|
||||
THINK_VOID,
|
||||
THINK_TURRET,
|
||||
|
@ -396,6 +383,22 @@ enum eThinkLevel {
|
|||
NUM_THINKLEVELS
|
||||
};
|
||||
|
||||
enum eAIEvent {
|
||||
AI_EVENT_NONE,
|
||||
AI_EVENT_WEAPON_FIRE,
|
||||
AI_EVENT_WEAPON_IMPACT,
|
||||
AI_EVENT_EXPLOSION,
|
||||
AI_EVENT_AMERICAN_VOICE,
|
||||
AI_EVENT_GERMAN_VOICE,
|
||||
AI_EVENT_AMERICAN_URGENT,
|
||||
AI_EVENT_GERMAN_URGENT,
|
||||
AI_EVENT_MISC,
|
||||
AI_EVENT_MISC_LOUD,
|
||||
AI_EVENT_FOOTSTEP,
|
||||
AI_EVENT_GRENADE,
|
||||
AI_EVENT_BADPLACE // Added in 2.0
|
||||
};
|
||||
|
||||
enum eActorNationality {
|
||||
ACTOR_NATIONALITY_DEFAULT,
|
||||
ACTOR_NATIONALITY_AMERICAN,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue