Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Generals/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ friend class Drawable; // for selection/deselection transactions
virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any)
virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected
virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list
virtual Bool areAllObjectsSelected(const std::vector<Object*>& objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list
virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of
virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of

Expand Down
15 changes: 15 additions & 0 deletions Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3335,6 +3335,21 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const

} // end isDrawableSelected

//-------------------------------------------------------------------------------------------------
/** Return true if all of the selected objects are in the drawable list */
//-------------------------------------------------------------------------------------------------
Bool InGameUI::areAllObjectsSelected(const std::vector<Object*>& objectsToCheck) const
{
for (std::vector<Object*>::const_iterator it = objectsToCheck.begin(); it != objectsToCheck.end(); ++it)
{
if (!(*it)->getDrawable()->isSelected())
return FALSE;
}

return TRUE;

} // end areAllObjectsSelected

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if (! TheGlobalData->m_useAlternateMouse || TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID)
{
deselectAll();
m_lastGroupSelGroup = -1;
}
}
}
Expand Down Expand Up @@ -1024,10 +1025,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
m_lastGroupSelTime = now;
}

Bool performSelection = TRUE;

// check for double-press to jump view
if ( now - m_lastGroupSelTime < 20 && group == m_lastGroupSelGroup )
{
DEBUG_LOG(("META: DOUBLETAP select team %d",group));
performSelection = FALSE;
Player *player = ThePlayerList->getLocalPlayer();
if (player)
{
Expand All @@ -1039,12 +1043,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if (numObjs > 0)
{
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt( objlist[numObjs-1]->getDrawable()->getPosition() );
Drawable* drawable = objlist[numObjs - 1]->getDrawable();
TheTacticalView->lookAt( drawable->getPosition() );
performSelection = !TheInGameUI->areAllObjectsSelected( objlist );
}
}
}
}
else

if ( performSelection )
{
TheInGameUI->deselectAllDrawables( false ); //No need to post message because we're just creating a new group!

Expand Down
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ friend class Drawable; // for selection/deselection transactions
virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any)
virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected
virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list
virtual Bool areAllObjectsSelected(const std::vector<Object*>& objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list
virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of
virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of

Expand Down
15 changes: 15 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3425,6 +3425,21 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const

} // end isDrawableSelected

//-------------------------------------------------------------------------------------------------
/** Return true if all of the selected objects are in the drawable list */
//-------------------------------------------------------------------------------------------------
Bool InGameUI::areAllObjectsSelected(const std::vector<Object*>& objectsToCheck) const
{
for (std::vector<Object*>::const_iterator it = objectsToCheck.begin(); it != objectsToCheck.end(); ++it)
{
if (!(*it)->getDrawable()->isSelected())
return FALSE;
}

return TRUE;

} // end areAllObjectsSelected

// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if( !TheInGameUI->getPreventLeftClickDeselectionInAlternateMouseModeForOneClick() )
{
deselectAll();
m_lastGroupSelGroup = -1;
}
else
{
Expand Down Expand Up @@ -1099,10 +1100,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
m_lastGroupSelTime = now;
}

Bool performSelection = TRUE;

// check for double-press to jump view
if ( now - m_lastGroupSelTime < 20 && group == m_lastGroupSelGroup )
{
DEBUG_LOG(("META: DOUBLETAP select team %d",group));
performSelection = FALSE;
Player *player = ThePlayerList->getLocalPlayer();
if (player)
{
Expand All @@ -1114,12 +1118,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if (numObjs > 0)
{
// if theres someone in the group, center the camera on them.
TheTacticalView->lookAt( objlist[numObjs-1]->getDrawable()->getPosition() );
Drawable* drawable = objlist[numObjs - 1]->getDrawable();
TheTacticalView->lookAt( drawable->getPosition() );
performSelection = !TheInGameUI->areAllObjectsSelected( objlist );
}
}
}
}
else

if ( performSelection )
{
TheInGameUI->deselectAllDrawables( false ); //No need to post message because we're just creating a new group!

Expand Down
Loading