Skip to content

Commit 92f8ceb

Browse files
committed
turning improvements (CLAUDE)
1 parent 3575a82 commit 92f8ceb

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData
7676
Bool m_approachRequiresLOS;
7777
Bool m_needToFaceTarget;
7878
Bool m_persistenceRequiresRecharge;
79-
Real m_facingAngleTolerance; ///< heading delta (radians) considered "facing target" for locomotors that can't turn in place
79+
Bool m_requiresMoveToTurn; ///< if set, orient by moving toward target (for locomotors that can't turn in place) instead of facing in place
80+
Real m_facingAngleTolerance; ///< heading delta (radians) considered "facing target" when m_requiresMoveToTurn
8081

8182
const ParticleSystemTemplate *m_disableFXParticleSystem;
8283
AudioEventRTS m_packSound;
@@ -114,6 +115,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData
114115
m_preTriggerUnstealthFrames = 0;
115116
m_needToFaceTarget = TRUE;
116117
m_persistenceRequiresRecharge = FALSE;
118+
m_requiresMoveToTurn = FALSE;
117119
m_facingAngleTolerance = 0.1f; // ~5.7 degrees
118120
}
119121

@@ -161,6 +163,7 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData
161163
{ "ApproachRequiresLOS", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) },
162164
{ "NeedToFaceTarget", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_needToFaceTarget ) },
163165
{ "PersistenceRequiresRecharge",INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_persistenceRequiresRecharge ) },
166+
{ "RequiresMoveToTurn", INI::parseBool, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_requiresMoveToTurn ) },
164167
{ "FacingAngleTolerance", INI::parseAngleReal, nullptr, offsetof( SpecialAbilityUpdateModuleData, m_facingAngleTolerance ) },
165168
{ 0, 0, 0, 0 }
166169
};

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,12 +1904,12 @@ Bool SpecialAbilityUpdate::isFacing()
19041904
{
19051905
if( !m_facingComplete && m_facingInitiated)
19061906
{
1907+
const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData();
19071908
Locomotor *loco = ai->getCurLocomotor();
1908-
if( loco && loco->getMinTurnSpeed() > 0.0f )
1909+
if( data->m_requiresMoveToTurn && loco && loco->getMinTurnSpeed() > 0.0f )
19091910
{
19101911
//This locomotor can't turn in place (e.g. wings); we're moving toward the
19111912
//target to turn. Consider facing complete once our heading is within tolerance.
1912-
const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData();
19131913
Real relAngle = ThePartitionManager->getRelativeAngle2D( getObject(), &m_targetPos );
19141914
if( fabs( relAngle ) <= data->m_facingAngleTolerance )
19151915
{
@@ -1987,11 +1987,11 @@ void SpecialAbilityUpdate::startFacing()
19871987
}
19881988
else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used...
19891989
{
1990+
const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData();
19901991
Locomotor *loco = ai->getCurLocomotor();
1991-
if( loco && loco->getMinTurnSpeed() > 0.0f )
1992+
if( data->m_requiresMoveToTurn && loco && loco->getMinTurnSpeed() > 0.0f )
19921993
{
19931994
//This locomotor can't turn in place (e.g. wings); facing in place does nothing.
1994-
const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData();
19951995
if( fabs( ThePartitionManager->getRelativeAngle2D( getObject(), &m_targetPos ) ) <= data->m_facingAngleTolerance )
19961996
{
19971997
//Already pointed at the target -- no need to move.

0 commit comments

Comments
 (0)