Make sure to prevent to transition to curious if curious isn't enabled (moh 2.30 feature)

This commit is contained in:
smallmodel 2023-10-23 11:59:06 +02:00
parent cf61ae0332
commit e850dd1963
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -4951,7 +4951,8 @@ void Actor::HandlePain(Event *ev)
//FIXME: macro //FIXME: macro
SetCuriousAnimHint(7); SetCuriousAnimHint(7);
if (m_bEnableEnemy && m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE) { // m_bIsCurious check: Added in 2.30
if (m_bEnableEnemy && m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_IDLE && m_bIsCurious) {
SetEnemyPos(attacker->origin); SetEnemyPos(attacker->origin);
m_pszDebugState = "from_pain"; m_pszDebugState = "from_pain";
SetThinkState(THINKSTATE_CURIOUS, THINKLEVEL_IDLE); SetThinkState(THINKSTATE_CURIOUS, THINKLEVEL_IDLE);
@ -5274,7 +5275,7 @@ void Actor::MovePath(float fMoveSpeed)
G_DebugLine(pos, dest, 1, 0, 0, 1); G_DebugLine(pos, dest, 1, 0, 0, 1);
for (current_path = m_Path.CurrentNode(); current_path != m_Path.LastNode(); current_path--) { for (current_path = m_Path.CurrentNode(); current_path != m_Path.LastNode(); current_path--) {
pos = current_path->point; pos = current_path->point;
dest = (current_path - 1)->point; dest = (current_path - 1)->point;
G_DebugLine(pos + Vector(0, 0, 32), dest + Vector(0, 0, 32), 0, 1, 0, 1); G_DebugLine(pos + Vector(0, 0, 32), dest + Vector(0, 0, 32), 0, 1, 0, 1);
@ -6438,21 +6439,21 @@ void Actor::DetectSmokeGrenades(void)
return; return;
} }
const Vector eyePos = VirtualEyePosition(); const Vector eyePos = VirtualEyePosition();
const float fDistSquared = (sprite->origin - eyePos).lengthSquared(); const float fDistSquared = (sprite->origin - eyePos).lengthSquared();
if (fDistSquared > Square(256) || InFOV(sprite->origin)) { if (fDistSquared > Square(256) || InFOV(sprite->origin)) {
if (G_SightTrace( if (G_SightTrace(
eyePos, eyePos,
vec_zero, vec_zero,
vec_zero, vec_zero,
sprite->origin, sprite->origin,
this, this,
NULL, NULL,
MASK_CANSEE, MASK_CANSEE,
qfalse, qfalse,
"Actor::DetectSmokeGrenades" "Actor::DetectSmokeGrenades"
)) { )) {
m_PotentialEnemies.ConfirmEnemy(this, sprite->owner); m_PotentialEnemies.ConfirmEnemy(this, sprite->owner);
} }
} }
@ -8213,6 +8214,11 @@ Should actor transition think state to grenade ?
*/ */
bool Actor::PassesTransitionConditions_Grenade(void) bool Actor::PassesTransitionConditions_Grenade(void)
{ {
if (!m_bIsCurious) {
// Added in 2.30
return false;
}
if (m_bLockThinkState || !m_bEnableEnemy) { if (m_bLockThinkState || !m_bEnableEnemy) {
return false; return false;
} }
@ -9848,6 +9854,7 @@ void Actor::Grenade_EventFire(Event *ev)
speed = dir.normalize(); speed = dir.normalize();
if (g_protocol >= PROTOCOL_MOHTA_MIN) { if (g_protocol >= PROTOCOL_MOHTA_MIN) {
// Added in 2.30
switch (m_iNationality) { switch (m_iNationality) {
case ACTOR_NATIONALITY_ITALIAN: case ACTOR_NATIONALITY_ITALIAN:
strGrenade = "models/projectiles/Bomba_ai.tik"; strGrenade = "models/projectiles/Bomba_ai.tik";