From a0936ede6553c202a45ceec82e6f349528da8da8 Mon Sep 17 00:00:00 2001 From: Matei Date: Sun, 22 Jan 2006 11:55:16 +0000 Subject: [PATCH] Fixes to the melee/ranged attack split. This was SVN commit r3403. --- source/simulation/BaseEntity.cpp | 3 +++ source/simulation/Entity.cpp | 3 +++ source/simulation/Entity.h | 7 +++--- source/simulation/EntityStateProcessing.cpp | 28 --------------------- 4 files changed, 10 insertions(+), 31 deletions(-) diff --git a/source/simulation/BaseEntity.cpp b/source/simulation/BaseEntity.cpp index 22e6ad7e96..5565b71e5d 100755 --- a/source/simulation/BaseEntity.cpp +++ b/source/simulation/BaseEntity.cpp @@ -45,6 +45,9 @@ CBaseEntity::CBaseEntity() AddProperty( L"traits.anchor.type", &m_anchorType ); AddProperty( L"traits.vision.los", &m_los ); AddProperty( L"traits.vision.permanent", &m_permanent ); + AddProperty( L"traits.health.regen_rate", &m_healthRegenRate ); + AddProperty( L"traits.health.regen_start", &m_healthRegenStart ); + AddProperty( L"traits.health.decay_rate", &m_healthDecayRate ); for( int t = 0; t < EVENT_LAST; t++ ) { diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index f786b9f431..f0f02137d1 100755 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -69,6 +69,9 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation ) AddProperty( L"traits.anchor.type", &m_anchorType ); AddProperty( L"traits.vision.los", &m_los ); AddProperty( L"traits.vision.permanent", &m_permanent ); + AddProperty( L"traits.health.regen_rate", &m_healthRegenRate ); + AddProperty( L"traits.health.regen_start", &m_healthRegenStart ); + AddProperty( L"traits.health.decay_rate", &m_healthDecayRate ); for( int t = 0; t < EVENT_LAST; t++ ) { diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index bc033d714d..7a6b3d47ca 100755 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -74,6 +74,10 @@ public: float m_turningRadius; float m_runRegenRate; float m_runDecayRate; + + float m_healthRegenRate; + float m_healthRegenStart; + float m_healthDecayRate; SEntityAction m_run; @@ -108,9 +112,6 @@ public: float m_healthBarHeight; int m_healthBarSize; - float m_healthRegenRate; - float m_healthRegenStart; - float m_healthDecayRate; bool m_healthDecay; // Minimap properties diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index e4f37ccfa6..ca9884713b 100755 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -331,21 +331,7 @@ bool CEntity::processContactAction( CEntityOrder* current, size_t UNUSED(timeste return( false ); current->m_data[0].location = current->m_data[0].entity->m_position; float Distance = (current->m_data[0].location - m_position).length(); - - //TODO: find a better way than assuming constant action indicators. - if ( current->m_data[1].data == 1 ) - { - //Are we closer using ranged attack? - if ( fabs(Distance - m_actions[4].m_MaxRange) < fabs(Distance - action->m_MaxRange) && - Distance > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end()) - { - action = &m_actions[4]; - current->m_data[1].data = 4; - } - else - action = &m_actions[1]; - } if( Distance < action->m_MaxRange ) { (int&)current->m_type = transition; @@ -456,20 +442,6 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times CVector2D delta = current->m_data[0].entity->m_position - m_position; float deltaLength = delta.length(); - //TODO: find a better way than assuming constant action indicators. - if ( current->m_data[1].data == 1 ) - { - //Are we closer using ranged attack? - if ( fabs(deltaLength - m_actions[4].m_MaxRange) < fabs(deltaLength - action->m_MaxRange) && - deltaLength > m_actions[4].m_MinRange && !m_shouldRun && m_actions.find( 4 ) != m_actions.end()) - { - action = &m_actions[4]; - current->m_data[1].data = 4; - } - else - action = &m_actions[1]; - } - float adjRange = action->m_MaxRange + m_bounds->m_radius + current->m_data[0].entity->m_bounds->m_radius; if( action->m_MinRange > 0.0f )